File::nonexistant is a directory


#1

I brought this up before, but it just bit me in the ass again, so I thought I’d warn everybody.

File f(File::nonexistant);
if (f.isDirectory())
  jassertfalse;

This will assert on linux and the mac and not on the pc.

On linux and the mac, the root directory and non existent are the same thing.


#2

Yes, it’s a bit of a tricky one, that.

The reason is that that directory names are stored without the trailing “/”, so File ("/") is stored internally as an empty string, and that’s the same as the non-existent file. I’ll try to think of with a better plan, but ideas are welcome on the subject!


#3

add . support?

. would correctly map to the root directory, but not end with a trailing slash.


#4

Hmm. That’s pretty good thinking…


#5