r=valeski, a=brendan
OS/2 bringup - Support for OS/2 special system directories
This commit is contained in:
mkaply%us.ibm.com 2000-06-27 21:23:51 +00:00
Родитель 5524653464
Коммит 6ed25d5b08
5 изменённых файлов: 78 добавлений и 22 удалений

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

@ -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

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

@ -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

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

@ -20,6 +20,7 @@
*
* Contributor(s):
* Doug Turner <dougt@netscape.com>
* 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;

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

@ -20,6 +20,7 @@
*
* Contributor(s):
* Doug Turner <dougt@netscape.com>
* 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();

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

@ -89,6 +89,8 @@ dump("Beos locations::\n");
dump("OS2 locations::\n");
// OS2
dumpPathOfProperty ("system.SystemDirectory");
dumpPathOfProperty ("system.OS2Directory");
dumpPathOfProperty ("system.DesktopDirectory");
// XPFE locations: