FileChooser native dialog fails to display when given path with drive letter that does not exist


#1

Windows specific problem, opened as issue on GitHub here:

https://github.com/WeAreROLI/JUCE/issues/200


#2

bump…


#3

A fix for this will appear on the develop branch shortly. Thank you for reporting.


#4

I notice that in your implementation you resorted to the check “path == path.getParentDirectory()” to see if a given File object represents a root path.

I was wondering if that check could be better suited for an explicit method in File, like:

bool File::isRootPath() const
{
    return *this == getParentDirectory();
}

That would make the code cleaner and also has the potential to be reused somewhere else (I would have used this method myself in my workaround for this specific issue, but I can also see it as a good fit to check wether a recursive search backwards in parents has ended).

I also considered naming this isRootDirectory(), but I don’t think it would be a good idea because that would seem to imply that the path actually exists as a directory.
In my opinion, naming it isRootPath() better represents the concept that it says something about the path itself, regardless of its actual existence or not.

EDIT: perhaps isRoot() is an equally good name but shorter


#5

Yes, that’s a sensible suggestion. I’ll add that now.