зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1435766 - Reimplement nsDirectoryService Mac getters in terms of GetSpecialSystemDirectory, r=xpcom-reviewers,mccr8
This makes the getters more consistent with getters on other platforms, and theoretically provides a faster way of getting these directories from C++ code in the future. Differential Revision: https://phabricator.services.mozilla.com/D142871
This commit is contained in:
Родитель
a8c8aab2e1
Коммит
3a5d9a53ba
|
@ -465,7 +465,36 @@ nsresult GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory,
|
|||
#else
|
||||
break;
|
||||
#endif
|
||||
#if defined(XP_WIN)
|
||||
#if defined(MOZ_WIDGET_COCOA)
|
||||
case Mac_SystemDirectory: {
|
||||
return GetOSXFolderType(kClassicDomain, kSystemFolderType, aFile);
|
||||
}
|
||||
case Mac_UserLibDirectory: {
|
||||
return GetOSXFolderType(kUserDomain, kDomainLibraryFolderType, aFile);
|
||||
}
|
||||
case Mac_HomeDirectory: {
|
||||
return GetOSXFolderType(kUserDomain, kDomainTopLevelFolderType, aFile);
|
||||
}
|
||||
case Mac_DefaultDownloadDirectory: {
|
||||
nsresult rv = GetOSXFolderType(kUserDomain, kDownloadsFolderType, aFile);
|
||||
if (NS_FAILED(rv)) {
|
||||
return GetOSXFolderType(kUserDomain, kDesktopFolderType, aFile);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
case Mac_UserDesktopDirectory: {
|
||||
return GetOSXFolderType(kUserDomain, kDesktopFolderType, aFile);
|
||||
}
|
||||
case Mac_LocalApplicationsDirectory: {
|
||||
return GetOSXFolderType(kLocalDomain, kApplicationsFolderType, aFile);
|
||||
}
|
||||
case Mac_UserPreferencesDirectory: {
|
||||
return GetOSXFolderType(kUserDomain, kPreferencesFolderType, aFile);
|
||||
}
|
||||
case Mac_PictureDocumentsDirectory: {
|
||||
return GetOSXFolderType(kUserDomain, kPictureDocumentsFolderType, aFile);
|
||||
}
|
||||
#elif defined(XP_WIN)
|
||||
case Win_SystemDirectory: {
|
||||
int32_t len = ::GetSystemDirectoryW(path, MAX_PATH);
|
||||
|
||||
|
|
|
@ -21,6 +21,15 @@ enum SystemDirectories {
|
|||
// supported getting...
|
||||
OS_CurrentWorkingDirectory = 4,
|
||||
|
||||
Mac_SystemDirectory = 101,
|
||||
Mac_UserLibDirectory = 102,
|
||||
Mac_HomeDirectory = 103,
|
||||
Mac_DefaultDownloadDirectory = 104,
|
||||
Mac_UserDesktopDirectory = 105,
|
||||
Mac_LocalApplicationsDirectory = 106,
|
||||
Mac_UserPreferencesDirectory = 107,
|
||||
Mac_PictureDocumentsDirectory = 108,
|
||||
|
||||
Win_SystemDirectory = 201,
|
||||
Win_WindowsDirectory = 202,
|
||||
Win_HomeDirectory = 203,
|
||||
|
|
|
@ -376,33 +376,29 @@ nsDirectoryService::GetFile(const char* aProp, bool* aPersistent,
|
|||
}
|
||||
#if defined(MOZ_WIDGET_COCOA)
|
||||
else if (inAtom == nsGkAtoms::DirectoryService_SystemDirectory) {
|
||||
rv = GetOSXFolderType(kClassicDomain, kSystemFolderType,
|
||||
getter_AddRefs(localFile));
|
||||
rv = GetSpecialSystemDirectory(Mac_SystemDirectory,
|
||||
getter_AddRefs(localFile));
|
||||
} else if (inAtom == nsGkAtoms::DirectoryService_UserLibDirectory) {
|
||||
rv = GetOSXFolderType(kUserDomain, kDomainLibraryFolderType,
|
||||
getter_AddRefs(localFile));
|
||||
rv = GetSpecialSystemDirectory(Mac_UserLibDirectory,
|
||||
getter_AddRefs(localFile));
|
||||
} else if (inAtom == nsGkAtoms::Home) {
|
||||
rv = GetOSXFolderType(kUserDomain, kDomainTopLevelFolderType,
|
||||
getter_AddRefs(localFile));
|
||||
rv =
|
||||
GetSpecialSystemDirectory(Mac_HomeDirectory, getter_AddRefs(localFile));
|
||||
} else if (inAtom == nsGkAtoms::DirectoryService_DefaultDownloadDirectory) {
|
||||
rv = GetOSXFolderType(kUserDomain, kDownloadsFolderType,
|
||||
getter_AddRefs(localFile));
|
||||
if (NS_FAILED(rv)) {
|
||||
rv = GetOSXFolderType(kUserDomain, kDesktopFolderType,
|
||||
getter_AddRefs(localFile));
|
||||
}
|
||||
rv = GetSpecialSystemDirectory(Mac_DefaultDownloadDirectory,
|
||||
getter_AddRefs(localFile));
|
||||
} else if (inAtom == nsGkAtoms::DirectoryService_OS_DesktopDirectory) {
|
||||
rv = GetOSXFolderType(kUserDomain, kDesktopFolderType,
|
||||
getter_AddRefs(localFile));
|
||||
rv = GetSpecialSystemDirectory(Mac_UserDesktopDirectory,
|
||||
getter_AddRefs(localFile));
|
||||
} else if (inAtom == nsGkAtoms::DirectoryService_LocalApplicationsDirectory) {
|
||||
rv = GetOSXFolderType(kLocalDomain, kApplicationsFolderType,
|
||||
getter_AddRefs(localFile));
|
||||
rv = GetSpecialSystemDirectory(Mac_LocalApplicationsDirectory,
|
||||
getter_AddRefs(localFile));
|
||||
} else if (inAtom == nsGkAtoms::DirectoryService_UserPreferencesDirectory) {
|
||||
rv = GetOSXFolderType(kUserDomain, kPreferencesFolderType,
|
||||
getter_AddRefs(localFile));
|
||||
rv = GetSpecialSystemDirectory(Mac_UserPreferencesDirectory,
|
||||
getter_AddRefs(localFile));
|
||||
} else if (inAtom == nsGkAtoms::DirectoryService_PictureDocumentsDirectory) {
|
||||
rv = GetOSXFolderType(kUserDomain, kPictureDocumentsFolderType,
|
||||
getter_AddRefs(localFile));
|
||||
rv = GetSpecialSystemDirectory(Mac_PictureDocumentsDirectory,
|
||||
getter_AddRefs(localFile));
|
||||
}
|
||||
#elif defined(XP_WIN)
|
||||
else if (inAtom == nsGkAtoms::DirectoryService_SystemDirectory) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче