diff --git a/mozilla/xpcom/io/nsDirectoryService.cpp b/mozilla/xpcom/io/nsDirectoryService.cpp index a777cba469f..fc4299eb6ff 100644 --- a/mozilla/xpcom/io/nsDirectoryService.cpp +++ b/mozilla/xpcom/io/nsDirectoryService.cpp @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * IBM Corp. */ #include "nsCOMPtr.h" @@ -251,7 +252,11 @@ nsIAtom* nsDirectoryService::sFontsDirectory = nsnull; nsIAtom* nsDirectoryService::sPreferencesDirectory = nsnull; nsIAtom* nsDirectoryService::sDocumentsDirectory = nsnull; nsIAtom* nsDirectoryService::sInternetSearchDirectory = nsnull; -#elif defined (XP_PC) && !defined(XP_OS2) +#elif defined (XP_OS2) +nsIAtom* nsDirectoryService::sSystemDirectory = nsnull; +nsIAtom* nsDirectoryService::sOS2Directory = nsnull; +nsIAtom* nsDirectoryService::sDesktopDirectory = nsnull; +#elif defined (XP_PC) nsIAtom* nsDirectoryService::sSystemDirectory = nsnull; nsIAtom* nsDirectoryService::sWindowsDirectory = nsnull; nsIAtom* nsDirectoryService::sHomeDirectory = nsnull; @@ -287,8 +292,6 @@ nsIAtom* nsDirectoryService::sSettingsDirectory = nsnull; nsIAtom* nsDirectoryService::sHomeDirectory = nsnull; nsIAtom* nsDirectoryService::sDesktopDirectory = nsnull; nsIAtom* nsDirectoryService::sSystemDirectory = nsnull; -#elif defined (XP_OS2) -nsIAtom* nsDirectoryService::sSystemDirectory = nsnull; #endif @@ -357,7 +360,11 @@ nsDirectoryService::Init() nsDirectoryService::sPreferencesDirectory = NS_NewAtom("system.PreferencesDirectory"); nsDirectoryService::sDocumentsDirectory = NS_NewAtom("system.DocumentsDirectory"); nsDirectoryService::sInternetSearchDirectory = NS_NewAtom("system.InternetSearchDirectory"); -#elif defined (XP_PC) && !defined(XP_OS2) +#elif defined (XP_OS2) + nsDirectoryService::sSystemDirectory = NS_NewAtom("system.SystemDirectory"); + nsDirectoryService::sOS2Directory = NS_NewAtom("system.OS2Directory"); + nsDirectoryService::sDesktopDirectory = NS_NewAtom("system.DesktopDirectory"); +#elif defined (XP_PC) nsDirectoryService::sSystemDirectory = NS_NewAtom("system.SystemDirectory"); nsDirectoryService::sWindowsDirectory = NS_NewAtom("system.WindowsDirectory"); nsDirectoryService::sHomeDirectory = NS_NewAtom("system.HomeDirectory"); @@ -393,8 +400,6 @@ nsDirectoryService::Init() nsDirectoryService::sHomeDirectory = NS_NewAtom("system.HomeDirectory"); nsDirectoryService::sDesktopDirectory = NS_NewAtom("system.DesktopDirectory"); nsDirectoryService::sSystemDirectory = NS_NewAtom("system.SystemDirectory"); -#elif defined (XP_OS2) - nsDirectoryService::sSystemDirectory = NS_NewAtom("system.SystemDirectory"); #endif rv = RegisterProvider(NS_STATIC_CAST(nsIDirectoryServiceProvider*, this)); @@ -447,7 +452,11 @@ nsDirectoryService::~nsDirectoryService() NS_IF_RELEASE(nsDirectoryService::sPreferencesDirectory); NS_IF_RELEASE(nsDirectoryService::sDocumentsDirectory); NS_IF_RELEASE(nsDirectoryService::sInternetSearchDirectory); -#elif defined (XP_PC) && !defined(XP_OS2) +#elif defined (XP_OS2) + NS_IF_RELEASE(nsDirectoryService::sSystemDirectory); + NS_IF_RELEASE(nsDirectoryService::sOS2Directory); + NS_IF_RELEASE(nsDirectoryService::sDesktopDirectory); +#elif defined (XP_PC) NS_IF_RELEASE(nsDirectoryService::sSystemDirectory); NS_IF_RELEASE(nsDirectoryService::sWindowsDirectory); NS_IF_RELEASE(nsDirectoryService::sHomeDirectory); @@ -483,8 +492,6 @@ nsDirectoryService::~nsDirectoryService() NS_IF_RELEASE(nsDirectoryService::sHomeDirectory); NS_IF_RELEASE(nsDirectoryService::sDesktopDirectory); NS_IF_RELEASE(nsDirectoryService::sSystemDirectory); -#elif defined (XP_OS2) - NS_IF_RELEASE(nsDirectoryService::sSystemDirectory); #endif @@ -744,7 +751,23 @@ nsDirectoryService::GetFile(const char *prop, PRBool *persistant, nsIFile **_ret nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Mac_InternetSearchDirectory); rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); } -#elif defined (XP_PC) && !defined(XP_OS2) +#elif defined (XP_OS2) + else if (inAtom == nsDirectoryService::sSystemDirectory) + { + nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::OS2_SystemDirectory); + rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + } + else if (inAtom == nsDirectoryService::sOS2Directory) + { + nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::OS2_OS2Directory); + rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + } + else if (inAtom == nsDirectoryService::sDesktopDirectory) + { + nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::OS2_DesktopDirectory); + rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + } +#elif defined (XP_PC) else if (inAtom == nsDirectoryService::sSystemDirectory) { nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_SystemDirectory); @@ -913,12 +936,6 @@ nsDirectoryService::GetFile(const char *prop, PRBool *persistant, nsIFile **_ret nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::BeOS_SystemDirectory); rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); } -#elif defined (XP_OS2) - else if (inAtom == nsDirectoryService::sSystemDirectory) - { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::OS2_SystemDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); - } #endif diff --git a/mozilla/xpcom/io/nsDirectoryService.h b/mozilla/xpcom/io/nsDirectoryService.h index c93c225b9eb..376b5189005 100644 --- a/mozilla/xpcom/io/nsDirectoryService.h +++ b/mozilla/xpcom/io/nsDirectoryService.h @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * IBM Corp. */ #ifndef nsDirectoryService_h___ @@ -76,6 +77,10 @@ private: static nsIAtom *sPreferencesDirectory; static nsIAtom *sDocumentsDirectory; static nsIAtom *sInternetSearchDirectory; +#elif defined (XP_OS2) + static nsIAtom *sSystemDirectory; + static nsIAtom *sOS2Directory; + static nsIAtom *sDesktopDirectory; #elif defined (XP_PC) static nsIAtom *sSystemDirectory; static nsIAtom *sWindowsDirectory; @@ -112,8 +117,6 @@ private: static nsIAtom *sHomeDirectory; static nsIAtom *sDesktopDirectory; static nsIAtom *sSystemDirectory; -#elif defined (XP_OS2) - static nsIAtom *sSystemDirectory; #endif diff --git a/mozilla/xpcom/io/nsSpecialSystemDirectory.cpp b/mozilla/xpcom/io/nsSpecialSystemDirectory.cpp index d515e751612..0ae3a1898e8 100644 --- a/mozilla/xpcom/io/nsSpecialSystemDirectory.cpp +++ b/mozilla/xpcom/io/nsSpecialSystemDirectory.cpp @@ -20,6 +20,7 @@ * * Contributor(s): * Doug Turner + * IBM Corp. */ #include "nsSpecialSystemDirectory.h" @@ -340,7 +341,7 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect // printf( "*** Warning warning OS_DriveDirectory called for"); ULONG ulBootDrive = 0; - char buffer[] = " :\\OS2"; + char buffer[] = " :\\OS2\\"; DosQuerySysInfo( QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, &ulBootDrive, sizeof ulBootDrive); buffer[0] = 'A' - 1 + ulBootDrive; // duh, 1-based index... @@ -795,15 +796,45 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect case OS2_SystemDirectory: { ULONG ulBootDrive = 0; - char buffer[] = " :\\OS2\\System"; + char buffer[] = " :\\OS2\\System\\"; DosQuerySysInfo( QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, &ulBootDrive, sizeof ulBootDrive); buffer[0] = 'A' - 1 + ulBootDrive; // duh, 1-based index... *this = buffer; #ifdef DEBUG - printf( "Got OS_SystemDirectory: %s\n", buffer); + printf( "Got OS2_SystemDirectory: %s\n", buffer); #endif + break; } + + case OS2_OS2Directory: + { + ULONG ulBootDrive = 0; + char buffer[] = " :\\OS2\\"; + DosQuerySysInfo( QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, + &ulBootDrive, sizeof ulBootDrive); + buffer[0] = 'A' - 1 + ulBootDrive; // duh, 1-based index... + *this = buffer; +#ifdef DEBUG + printf( "Got OS2_OS2Directory: %s\n", buffer); +#endif + break; + } + + case OS2_DesktopDirectory: + { + ULONG ulBootDrive = 0; + char buffer[] = " :\\desktop\\"; + DosQuerySysInfo( QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, + &ulBootDrive, sizeof ulBootDrive); + buffer[0] = 'A' - 1 + ulBootDrive; // duh, 1-based index... + *this = buffer; +#ifdef DEBUG + printf( "Got OS2_DesktopDirectory: %s\n", buffer); +#endif + break; + } + #endif default: break; diff --git a/mozilla/xpcom/io/nsSpecialSystemDirectory.h b/mozilla/xpcom/io/nsSpecialSystemDirectory.h index ea9b0176dc0..70e4580cc19 100644 --- a/mozilla/xpcom/io/nsSpecialSystemDirectory.h +++ b/mozilla/xpcom/io/nsSpecialSystemDirectory.h @@ -20,6 +20,7 @@ * * Contributor(s): * Doug Turner + * IBM Corp. */ #ifndef _NSSPECIALSYSTEMDIRECTORY_H_ @@ -101,7 +102,9 @@ class NS_COM nsSpecialSystemDirectory : public nsFileSpec , BeOS_DesktopDirectory = 403 , BeOS_SystemDirectory = 404 - , OS2_SystemDirectory = 501 + , OS2_SystemDirectory = 501 + , OS2_OS2Directory = 502 + , OS2_DesktopDirectory = 503 }; //nsSpecialSystemDirectory(); diff --git a/mozilla/xpcom/tests/utils/dirs.js b/mozilla/xpcom/tests/utils/dirs.js index 53ba5b60199..24e766ead96 100644 --- a/mozilla/xpcom/tests/utils/dirs.js +++ b/mozilla/xpcom/tests/utils/dirs.js @@ -89,6 +89,8 @@ dump("Beos locations::\n"); dump("OS2 locations::\n"); // OS2 dumpPathOfProperty ("system.SystemDirectory"); + dumpPathOfProperty ("system.OS2Directory"); + dumpPathOfProperty ("system.DesktopDirectory"); // XPFE locations: