File::moveFile() bug


If the file is moved to the sample place (destination filename == source filename), then it is deleted (instead of doing nothing).


I don’t see how that can be possible… There’s a check in the code that does this:

bool File::moveFileTo (const File& newFile) const throw() { if (newFile.fullPath == fullPath) return true;

What are you doing that manages to avoid getting caught by this?


Hmm maybe I was in release mode (no asserts) and did something like moving (C:\test.txt) into “”, “” being also c:\ ? Is that possible?
Don’t remember exactly how I did it but the file I moved was somehow deleted afterwards. I’ll have to check again what went wrong.

Ah I see one possibility: If I used C:/test.txt windows will still eat it, but the full paths will perhaps not correspond to each other because JUCE uses \ as delimiters, because that’s standard on Windows?


By the time a path gets used inside a File object, it should have been normalised, so I’d expect the two strings to match, regardless of how you created them…