MacGui: try to recreate the tmp folder only on macOS 14 and later

It shouldn't make a difference, but maybe it
will help on macOS 13.

(cherry picked from commit ca9906773b)
This commit is contained in:
Damiano Galassi 2025-08-29 09:02:00 +02:00
parent 330a666f03
commit cf413f12b1
No known key found for this signature in database
GPG Key ID: 5452E231DFDBCA11
1 changed files with 10 additions and 7 deletions

View File

@ -157,14 +157,17 @@ HB_OBJC_DIRECT_MEMBERS
return nil;
}
// macOS Sonoma moved the parent of our temporary folder
// to the app sandbox container, and the user might have deleted it,
// so ensure the whole path is available to avoid failing later
// when trying to write the temp files
NSURL *directoryURL = HBCore.temporaryDirectoryURL;
if (directoryURL)
if (@available(macOS 14, *))
{
[NSFileManager.defaultManager createDirectoryAtURL:directoryURL withIntermediateDirectories:YES attributes:nil error:NULL];
// macOS Sonoma moved the parent of our temporary folder
// to the app sandbox container, and the user might have deleted it,
// so ensure the whole path is available to avoid failing later
// when trying to write the temp files
NSURL *directoryURL = HBCore.temporaryDirectoryURL;
if (directoryURL)
{
[NSFileManager.defaultManager createDirectoryAtURL:directoryURL withIntermediateDirectories:YES attributes:nil error:NULL];
}
}
}