зеркало из https://github.com/mozilla/pjs.git
Bug 399498 - "use XDG downloads dir as default downloads dir" (use XDG download dir, with a fallback to the current default if the XDG user dirs are disabled) [p=chpe@gnome.org (Christian Persch) r=sdwilsh r=bsmedberg a1.9=damons]
This commit is contained in:
Родитель
475ddcf891
Коммит
7dd0a5db6c
|
@ -1123,7 +1123,7 @@ nsDownloadManager::GetDefaultDownloadsDirectory(nsILocalFile **aResult)
|
||||||
// XP/2K:
|
// XP/2K:
|
||||||
// Desktop/Downloads
|
// Desktop/Downloads
|
||||||
// Linux:
|
// Linux:
|
||||||
// Home/Downloads
|
// XDG user dir spec, with a fallback to Home/Downloads
|
||||||
|
|
||||||
nsXPIDLString folderName;
|
nsXPIDLString folderName;
|
||||||
mBundle->GetStringFromName(NS_LITERAL_STRING("downloadsFolder").get(),
|
mBundle->GetStringFromName(NS_LITERAL_STRING("downloadsFolder").get(),
|
||||||
|
@ -1167,6 +1167,19 @@ nsDownloadManager::GetDefaultDownloadsDirectory(nsILocalFile **aResult)
|
||||||
rv = downloadDir->Append(folderName);
|
rv = downloadDir->Append(folderName);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
}
|
||||||
|
#elif defined(XP_UNIX)
|
||||||
|
rv = dirService->Get(NS_UNIX_DEFAULT_DOWNLOAD_DIR,
|
||||||
|
NS_GET_IID(nsILocalFile),
|
||||||
|
getter_AddRefs(downloadDir));
|
||||||
|
// fallback to Home/Downloads
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
rv = dirService->Get(NS_UNIX_HOME_DIR,
|
||||||
|
NS_GET_IID(nsILocalFile),
|
||||||
|
getter_AddRefs(downloadDir));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
rv = downloadDir->Append(folderName);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
rv = dirService->Get(NS_OS_HOME_DIR,
|
rv = dirService->Get(NS_OS_HOME_DIR,
|
||||||
NS_GET_IID(nsILocalFile),
|
NS_GET_IID(nsILocalFile),
|
||||||
|
|
|
@ -194,6 +194,7 @@
|
||||||
#define NS_UNIX_XDG_PUBLIC_SHARE_DIR "XDGPubSh"
|
#define NS_UNIX_XDG_PUBLIC_SHARE_DIR "XDGPubSh"
|
||||||
#define NS_UNIX_XDG_TEMPLATES_DIR "XDGTempl"
|
#define NS_UNIX_XDG_TEMPLATES_DIR "XDGTempl"
|
||||||
#define NS_UNIX_XDG_VIDEOS_DIR "XDGVids"
|
#define NS_UNIX_XDG_VIDEOS_DIR "XDGVids"
|
||||||
|
#define NS_UNIX_DEFAULT_DOWNLOAD_DIR "DfltDwnld"
|
||||||
#elif defined (XP_OS2)
|
#elif defined (XP_OS2)
|
||||||
#define NS_OS2_DIR "OS2Dir"
|
#define NS_OS2_DIR "OS2Dir"
|
||||||
#define NS_OS2_HOME_DIR NS_OS_HOME_DIR
|
#define NS_OS2_HOME_DIR NS_OS_HOME_DIR
|
||||||
|
|
Загрузка…
Ссылка в новой задаче