A user of one of our products hit an edge case in copyFileTo
where *this == newFile
does return false
for the same physical file because it compares the path strings.
This leads to the unlucky case that the function deletes the file and after that copyInternal
fails because the file isn’t there anymore.
Here the JUCE code:
bool File::copyFileTo (const File& newFile) const
{
return (*this == newFile)
|| (exists() && newFile.deleteFile() && copyInternal (newFile));
}
Here is an example of such a case where both paths point to the same directory or file in different ways:
/Volumes/Macintosh HD/Library/Audio/Plug-Ins
is the same as:
/Library/Audio/Plug-Ins
We should make sure that this can’t happen. Is there a way to resolve this problem without handling every special case?
I don’t see any solution for this at the moment. Any help is welcome.