From a607ba1e42246af82be1a7ff242d25809d2f200a Mon Sep 17 00:00:00 2001 From: "neeti%netscape.com" Date: Fri, 17 Sep 1999 23:25:05 +0000 Subject: [PATCH] Added GetDefaultFolder api --- xpfe/appshell/public/nsFileLocations.h | 3 ++ xpfe/appshell/src/nsFileLocations.cpp | 47 ++++++++++++++++++++++++-- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/xpfe/appshell/public/nsFileLocations.h b/xpfe/appshell/public/nsFileLocations.h index a657db3eeefc..4a93557e0727 100644 --- a/xpfe/appshell/public/nsFileLocations.h +++ b/xpfe/appshell/public/nsFileLocations.h @@ -63,6 +63,9 @@ class NS_APPSHELL nsSpecialFileSpec : public nsFileSpec , App_ProfileDefaultsFolder30 = App_DirectoryBase + 16 , App_ProfileDefaultsFolder40 = App_DirectoryBase + 17 , App_ProfileDefaultsFolder50 = App_DirectoryBase + 18 + , App_PrefDefaultsFolder50 = App_DirectoryBase + 19 + + , App_DefaultsFolder50 = App_DirectoryBase + 25 , App_ComponentsDirectory = App_DirectoryBase + 30 , App_ChromeDirectory = App_DirectoryBase + 31 diff --git a/xpfe/appshell/src/nsFileLocations.cpp b/xpfe/appshell/src/nsFileLocations.cpp index 7ad1e988d967..2e7a5ba2bf38 100644 --- a/xpfe/appshell/src/nsFileLocations.cpp +++ b/xpfe/appshell/src/nsFileLocations.cpp @@ -198,7 +198,7 @@ static void GetDefaultUserProfileRoot(nsFileSpec& outSpec) //---------------------------------------------------------------------------------------- -static void GetProfileDefaultsFolder(nsFileSpec& outSpec) +static void GetDefaultsFolder(nsFileSpec& outSpec) //---------------------------------------------------------------------------------------- { nsSpecialSystemDirectory cwd(nsSpecialSystemDirectory::OS_CurrentProcessDirectory); @@ -210,8 +210,45 @@ static void GetProfileDefaultsFolder(nsFileSpec& outSpec) #endif outSpec = cwd; +} // GetDefaultsFolder + +//---------------------------------------------------------------------------------------- +static void GetProfileDefaultsFolder(nsFileSpec& outSpec) +//---------------------------------------------------------------------------------------- +{ + nsFileSpec cwd; + GetDefaultsFolder(cwd); + + if(cwd) { +#if defined(XP_MAC) + cwd += "Profile"; +#else + cwd += "profile"; +#endif + + outSpec = cwd; + } } // GetProfileDefaultsFolder +//---------------------------------------------------------------------------------------- +static void GetPrefDefaultsFolder(nsFileSpec& outSpec) +//---------------------------------------------------------------------------------------- +{ + nsFileSpec cwd; + GetDefaultsFolder(cwd); + + if(cwd) { +#if defined(XP_MAC) + cwd += "Pref"; +#else + cwd += "pref"; +#endif + + outSpec = cwd; + } +} // GetProfileDefaultsFolder + + //======================================================================================== // Implementation of nsSpecialFileSpec @@ -290,7 +327,10 @@ void nsSpecialFileSpec::operator = (Type aType) #endif } break; - + + case App_DefaultsFolder50: + GetDefaultsFolder(*this); + break; case App_UserProfileDirectory30: case App_UserProfileDirectory40: NS_NOTYETIMPLEMENTED("Write me!"); @@ -314,6 +354,9 @@ void nsSpecialFileSpec::operator = (Type aType) break; case App_ProfileDefaultsFolder50: GetProfileDefaultsFolder(*this); + break; + case App_PrefDefaultsFolder50: + GetPrefDefaultsFolder(*this); break;