Bug 788924 - Implement "pictures", "music", and "videos" special folders. r=dougt
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Fri, 07 Sep 2012 16:23:01 -0400
changeset 110909 66f34fb03d41a4fb3dc7ebeae0e1c036afeeabc6
parent 110908 c87c20436def105794177eaa2edcc9cfe39b00d4
child 110910 f298ffd6a36d9a956e3cc751322d97008c8ec8ed
push id1708
push userakeybl@mozilla.com
push dateMon, 19 Nov 2012 21:10:21 +0000
treeherdermozilla-beta@27b14fe50103 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdougt
bugs788924
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 788924 - Implement "pictures", "music", and "videos" special folders. r=dougt
xpcom/io/SpecialSystemDirectory.cpp
xpcom/io/SpecialSystemDirectory.h
xpcom/io/nsDirectoryService.cpp
xpcom/io/nsDirectoryServiceAtomList.h
xpcom/io/nsDirectoryServiceDefs.h
--- a/xpcom/io/SpecialSystemDirectory.cpp
+++ b/xpcom/io/SpecialSystemDirectory.cpp
@@ -742,16 +742,28 @@ GetSpecialSystemDirectory(SystemDirector
         }
         case Win_LocalAppdata:
         {
             nsresult rv = GetWindowsFolder(CSIDL_LOCAL_APPDATA, aFile);
             if (NS_FAILED(rv))
                 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)
         case Unix_LocalDirectory:
             return NS_NewNativeLocalFile(nsDependentCString("/usr/local/netscape/"),
                                          true,
                                          aFile);
         case Unix_LibDirectory:
--- a/xpcom/io/SpecialSystemDirectory.h
+++ b/xpcom/io/SpecialSystemDirectory.h
@@ -69,16 +69,19 @@ enum SystemDirectories {
   Win_Common_Desktopdirectory = 224,   
   Win_Appdata               =   225,   
   Win_Printhood             =   226,   
   Win_Cookies               =   227, 
   Win_LocalAppdata          =   228,
   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,   
   Unix_HomeDirectory        =   303,
   Unix_XDG_Desktop          =   304,
   Unix_XDG_Documents        =   305,
   Unix_XDG_Download         =   306,
   Unix_XDG_Music            =   307,
--- a/xpcom/io/nsDirectoryService.cpp
+++ b/xpcom/io/nsDirectoryService.cpp
@@ -846,16 +846,28 @@ nsDirectoryService::GetFile(const char *
     else if (inAtom == nsDirectoryService::sWinCookiesDirectory)
     {
         rv = GetSpecialSystemDirectory(Win_Cookies, getter_AddRefs(localFile)); 
     }
     else if (inAtom == nsDirectoryService::sDefaultDownloadDirectory)
     {
         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)
     {
         rv = GetSpecialSystemDirectory(Unix_LocalDirectory, getter_AddRefs(localFile)); 
     }
     else if (inAtom == nsDirectoryService::sLibDirectory)
     {
--- a/xpcom/io/nsDirectoryServiceAtomList.h
+++ b/xpcom/io/nsDirectoryServiceAtomList.h
@@ -68,16 +68,19 @@ DIR_ATOM(sCommon_Programs, NS_WIN_COMMON
 DIR_ATOM(sCommon_Startup, NS_WIN_COMMON_STARTUP_DIR)
 DIR_ATOM(sCommon_Desktopdirectory, NS_WIN_COMMON_DESKTOP_DIRECTORY)
 DIR_ATOM(sCommon_AppData, NS_WIN_COMMON_APPDATA_DIR)
 DIR_ATOM(sAppdata, NS_WIN_APPDATA_DIR)
 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)
 DIR_ATOM(sDefaultDownloadDirectory, NS_UNIX_DEFAULT_DOWNLOAD_DIR)
 DIR_ATOM(sXDGDesktop, NS_UNIX_XDG_DESKTOP_DIR)
 DIR_ATOM(sXDGDocuments, NS_UNIX_XDG_DOCUMENTS_DIR)
 DIR_ATOM(sXDGDownload, NS_UNIX_XDG_DOWNLOAD_DIR)
 DIR_ATOM(sXDGMusic, NS_UNIX_XDG_MUSIC_DIR)
--- a/xpcom/io/nsDirectoryServiceDefs.h
+++ b/xpcom/io/nsDirectoryServiceDefs.h
@@ -117,16 +117,19 @@
     #define NS_WIN_COMMON_STARTUP_DIR           "CmStrt"
     #define NS_WIN_COMMON_DESKTOP_DIRECTORY     "CmDeskP"
     #define NS_WIN_COMMON_APPDATA_DIR           "CmAppData"
     #define NS_WIN_APPDATA_DIR                  "AppData"
     #define NS_WIN_LOCAL_APPDATA_DIR            "LocalAppData"
     #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"
     #define NS_UNIX_HOME_DIR                    NS_OS_HOME_DIR
     #define NS_UNIX_XDG_DESKTOP_DIR             "XDGDesk"
     #define NS_UNIX_XDG_DOCUMENTS_DIR           "XDGDocs"
     #define NS_UNIX_XDG_DOWNLOAD_DIR            "XDGDwnld"
     #define NS_UNIX_XDG_MUSIC_DIR               "XDGMusic"