Bug 788924 - Implement "pictures", "music", and "videos" special folders. r=dougt

This commit is contained in:
Masatoshi Kimura 2012-09-07 16:23:01 -04:00
parent b68f2e85d5
commit 36583b9824
5 changed files with 33 additions and 0 deletions

View File

@ -747,6 +747,18 @@ GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory,
rv = GetRegWindowsAppDataFolder(true, aFile);
return rv;
}
case Win_Pictures:
{
return GetWindowsFolder(CSIDL_MYPICTURES, aFile);
}
case Win_Music:
{
return GetWindowsFolder(CSIDL_MYMUSIC, aFile);
}
case Win_Videos:
{
return GetWindowsFolder(CSIDL_MYVIDEO, aFile);
}
#endif // XP_WIN
#if defined(XP_UNIX)

View File

@ -74,6 +74,9 @@ enum SystemDirectories {
Win_ProgramFiles = 229,
Win_Downloads = 230,
Win_Common_AppData = 231,
Win_Pictures = 232,
Win_Music = 233,
Win_Videos = 234,
Unix_LocalDirectory = 301,
Unix_LibDirectory = 302,

View File

@ -851,6 +851,18 @@ nsDirectoryService::GetFile(const char *prop, bool *persistent, nsIFile **_retva
{
rv = GetSpecialSystemDirectory(Win_Downloads, getter_AddRefs(localFile));
}
else if (inAtom == nsDirectoryService::sPictures)
{
rv = GetSpecialSystemDirectory(Win_Pictures, getter_AddRefs(localFile));
}
else if (inAtom == nsDirectoryService::sMusic)
{
rv = GetSpecialSystemDirectory(Win_Music, getter_AddRefs(localFile));
}
else if (inAtom == nsDirectoryService::sVideos)
{
rv = GetSpecialSystemDirectory(Win_Videos, getter_AddRefs(localFile));
}
#elif defined (XP_UNIX)
else if (inAtom == nsDirectoryService::sLocalDirectory)

View File

@ -73,6 +73,9 @@ DIR_ATOM(sLocalAppdata, NS_WIN_LOCAL_APPDATA_DIR)
DIR_ATOM(sPrinthood, NS_WIN_PRINTHOOD)
DIR_ATOM(sWinCookiesDirectory, NS_WIN_COOKIES_DIR)
DIR_ATOM(sDefaultDownloadDirectory, NS_WIN_DEFAULT_DOWNLOAD_DIR)
DIR_ATOM(sPictures, NS_WIN_PICTURES_DIR)
DIR_ATOM(sMusic, NS_WIN_MUSIC_DIR)
DIR_ATOM(sVideos, NS_WIN_VIDEOS_DIR)
#elif defined (XP_UNIX)
DIR_ATOM(sLocalDirectory, NS_UNIX_LOCAL_DIR)
DIR_ATOM(sLibDirectory, NS_UNIX_LIB_DIR)

View File

@ -122,6 +122,9 @@
#define NS_WIN_PRINTHOOD "PrntHd"
#define NS_WIN_COOKIES_DIR "CookD"
#define NS_WIN_DEFAULT_DOWNLOAD_DIR "DfltDwnld"
#define NS_WIN_PICTURES_DIR "Pict"
#define NS_WIN_MUSIC_DIR "Music"
#define NS_WIN_VIDEOS_DIR "Vids"
#elif defined (XP_UNIX)
#define NS_UNIX_LOCAL_DIR "Locl"
#define NS_UNIX_LIB_DIR "LibD"