Due to some recent bungling of Finder when macOS Ventura hit the market, we’re unable to copy files to hidden drives.
This was a hard one to track down, and we might have caught this a bit earlier if JUCE’s File::copyInternal
(and the user facing juce::File::copyFileTo
) logged errors and/or returned a juce::Result
instead of a bool
.
FWIW – what did help was this roughed in code for macOS:
bool File::copyInternal (const File& dest) const
{
JUCE_AUTORELEASEPOOL
{
NSFileManager* fm = [NSFileManager defaultManager];
NSError* error = nil;
if (! ([fm fileExistsAtPath: juceStringToNS (fullPath)]
&& [fm copyItemAtPath: juceStringToNS (fullPath)
toPath: juceStringToNS (dest.getFullPathName())
error: &error]))
{
if (error != nullptr)
{
String message = "ERROR --- juce::File::copyInternal";
message
<< newLine << "localizedDescription: " << nsStringToJuce (error.localizedDescription)
<< newLine << "localizedFailureReason: " << nsStringToJuce (error.localizedFailureReason)
<< newLine << "localizedRecoverySuggestion: " << nsStringToJuce (error.localizedRecoverySuggestion)
<< newLine << "domain: " << nsStringToJuce (error.domain)
<< newLine << "code: " << String ((int64) error.code)
<< newLine;
Logger::writeToLog (message);
}
return false;
}
return true;
}
}