Backed out changeset c5e3cdc1f944 (bug 1795568) for causing hybrid bustage on nsAppFileLocationProvider.cpp. CLOSED TREE

This commit is contained in:
Csoregi Natalia 2022-12-19 23:54:41 +02:00
parent d9c2476649
commit 3853193d23
3 changed files with 8 additions and 12 deletions

View File

@ -39,8 +39,6 @@ void CopyQuarantineReferrerUrl(const CFStringRef aFilePath,
CFURLRef GetTemporaryFolderCFURLRef();
CFURLRef GetProductDirectoryCFURLRef(bool aLocal);
} // namespace CocoaFileUtils
#endif

View File

@ -279,11 +279,4 @@ CFURLRef GetTemporaryFolderCFURLRef() {
return tempDir == nil ? NULL : (CFURLRef)[NSURL fileURLWithPath:tempDir isDirectory:YES];
}
CFURLRef GetProductDirectoryCFURLRef(bool aLocal) {
NSSearchPathDirectory folderType = aLocal ? NSCachesDirectory : NSLibraryDirectory;
NSFileManager* manager = [NSFileManager defaultManager];
return static_cast<CFURLRef>([[manager URLsForDirectory:folderType
inDomains:NSUserDomainMask] firstObject]);
}
} // namespace CocoaFileUtils

View File

@ -182,14 +182,19 @@ nsresult nsAppFileLocationProvider::GetProductDirectory(nsIFile** aLocalFile,
nsCOMPtr<nsIFile> localDir;
#if defined(MOZ_WIDGET_COCOA)
FSRef fsRef;
OSType folderType =
aLocal ? (OSType)kCachedDataFolderType : (OSType)kDomainLibraryFolderType;
OSErr err = ::FSFindFolder(kUserDomain, folderType, kCreateFolder, &fsRef);
if (err) {
return NS_ERROR_FAILURE;
}
NS_NewLocalFile(u""_ns, true, getter_AddRefs(localDir));
if (!localDir) {
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsILocalFileMac> localDirMac(do_QueryInterface(localDir));
rv = localDirMac->InitWithCFURL(
CocoaFileUtils::GetProductDirectoryCFURLRef(aLocal));
rv = localDirMac->InitWithFSRef(&fsRef);
if (NS_FAILED(rv)) {
return rv;
}