isAChildOf doesn't work with relative paths


#1

I'm still using JUCE 3, I just noticed that isAChildOf doesn't work when there are relative paths.

For example, the file:

/Documents/Pictures/Album/../../file.png

isAChildOf returns false with this path:

/Documents/

What can I do?


#2

Works here on JUCE 4.1.

Code:

int main()
{
    File f1 ("/Documents/Pictures/Album/../../file.png");
    File f2 ("/Documents/");

    std::cout << std::boolalpha << f1.isAChildOf (f2) << std::endl;
}

Output:

true

Please upgrade to the newest JUCE version and try again.


#3

Thanks for your reply.

I updated to 4.1 but I'm still getting the same problem. My example was wrong, it should be more like this:

    File f1 ("/Documents/Album1/Subfolder/../../Album2/file.png");
    File f2 ("/Documents/Album2/");

result is false but should be true.

I don't think that isAChildOf actually resolves the relative path.


#4

Hmm, ok, thanks. Yes, it doesn't check the path for ellipsis. I'll look into it..