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:
reed@reedloden.com 2008-03-12 15:40:51 -07:00
Родитель bd2f12ba01
Коммит 75b740fd49
2 изменённых файлов: 15 добавлений и 1 удалений

Просмотреть файл

@ -1123,7 +1123,7 @@ nsDownloadManager::GetDefaultDownloadsDirectory(nsILocalFile **aResult)
// XP/2K:
// Desktop/Downloads
// Linux:
// Home/Downloads
// XDG user dir spec, with a fallback to Home/Downloads
nsXPIDLString folderName;
mBundle->GetStringFromName(NS_LITERAL_STRING("downloadsFolder").get(),
@ -1167,6 +1167,19 @@ nsDownloadManager::GetDefaultDownloadsDirectory(nsILocalFile **aResult)
rv = downloadDir->Append(folderName);
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
rv = dirService->Get(NS_OS_HOME_DIR,
NS_GET_IID(nsILocalFile),

Просмотреть файл

@ -194,6 +194,7 @@
#define NS_UNIX_XDG_PUBLIC_SHARE_DIR "XDGPubSh"
#define NS_UNIX_XDG_TEMPLATES_DIR "XDGTempl"
#define NS_UNIX_XDG_VIDEOS_DIR "XDGVids"
#define NS_UNIX_DEFAULT_DOWNLOAD_DIR "DfltDwnld"
#elif defined (XP_OS2)
#define NS_OS2_DIR "OS2Dir"
#define NS_OS2_HOME_DIR NS_OS_HOME_DIR