зеркало из https://github.com/mozilla/pjs.git
# 25555
r= dougt@netscape.com OS/2 changes for Mozilla - add #ifdef, change #ifdef
This commit is contained in:
Родитель
30135b40f4
Коммит
26066c1a6d
|
@ -473,8 +473,9 @@ void nsFileSpecHelpers::MakeAllDirectories(const char* inPath, int mode)
|
|||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
#if defined(XP_PC)
|
||||
#if defined(XP_OS2)
|
||||
#include "nsFileSpecOS2.cpp" // OS/2-specific implementations
|
||||
#elif defined(XP_PC)
|
||||
#include "nsFileSpecWin.cpp" // Windows-specific implementations
|
||||
#elif defined(XP_MAC)
|
||||
//#include "nsFileSpecMac.cpp" // Macintosh-specific implementations
|
||||
|
@ -1040,7 +1041,11 @@ PRBool nsFileSpec::operator == (const nsFileSpec& inOther) const
|
|||
#if defined(XP_PC)
|
||||
#define DIR_SEPARATOR '\\' // XXX doesn't NSPR have this?
|
||||
/* windows does not care about case. */
|
||||
#ifdef XP_OS2
|
||||
#define DIR_STRCMP strcmp
|
||||
#else
|
||||
#define DIR_STRCMP _stricmp
|
||||
#endif
|
||||
#else
|
||||
#define DIR_SEPARATOR '/'
|
||||
#if defined(VMS)
|
||||
|
|
|
@ -121,7 +121,7 @@
|
|||
//========================================================================================
|
||||
// Compiler-specific macros, as needed
|
||||
//========================================================================================
|
||||
#if !defined(NS_USING_NAMESPACE) && (defined(__MWERKS__) || defined(XP_PC))
|
||||
#if !defined(NS_USING_NAMESPACE) && (defined(__MWERKS__) || (defined(XP_PC) && !defined(XP_OS2)))
|
||||
#define NS_USING_NAMESPACE
|
||||
#endif
|
||||
|
||||
|
@ -144,6 +144,13 @@
|
|||
#ifdef XP_MAC
|
||||
#include <Files.h>
|
||||
#elif defined(XP_UNIX) || defined (XP_OS2) || defined(XP_BEOS)
|
||||
#if defined(XP_OS2)
|
||||
#define INCL_DOS
|
||||
#define INCL_DOSERRORS
|
||||
#include <os2.h>
|
||||
#include <sys/types.h> // required for dirent.h
|
||||
#include "prio.h"
|
||||
#endif
|
||||
#include <dirent.h>
|
||||
#elif defined(XP_PC)
|
||||
|
||||
|
|
|
@ -103,11 +103,11 @@ class nsIFileSpec;
|
|||
//========================================================================================
|
||||
// Compiler-specific macros, as needed
|
||||
//========================================================================================
|
||||
#if !defined(NS_USING_NAMESPACE) && (defined(__MWERKS__) || defined(XP_PC))
|
||||
#if !defined(NS_USING_NAMESPACE) && (defined(__MWERKS__) || (defined(XP_PC) && !defined(XP_OS2)))
|
||||
#define NS_USING_NAMESPACE
|
||||
#endif
|
||||
|
||||
#if !defined(NS_USING_STL) && (defined(__MWERKS__) || defined(XP_PC))
|
||||
#if !defined(NS_USING_STL) && (defined(__MWERKS__) || (defined(XP_PC) && !defined(XP_OS2)))
|
||||
#define NS_USING_STL
|
||||
#endif
|
||||
|
||||
|
|
|
@ -30,11 +30,16 @@
|
|||
#include <Files.h>
|
||||
#include <Memory.h>
|
||||
#include <Processes.h>
|
||||
#elif defined(XP_PC)
|
||||
#elif defined(XP_PC) && !defined (XP_OS2)
|
||||
#include <windows.h>
|
||||
#include <shlobj.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#elif defined(XP_OS2)
|
||||
#define MAX_PATH _MAX_PATH
|
||||
#include <os2.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#elif defined(XP_UNIX)
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -86,7 +91,7 @@ private:
|
|||
static nsHashtable *systemDirectoriesLocations = NULL;
|
||||
|
||||
|
||||
#if XP_PC
|
||||
#if defined (XP_PC) && !defined (XP_OS2)
|
||||
//----------------------------------------------------------------------------------------
|
||||
static char* MakeUpperCase(char* aPath)
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
@ -142,7 +147,7 @@ Clean:
|
|||
|
||||
pMalloc->Release();
|
||||
} // GetWindowsFolder
|
||||
#endif // XP_PC
|
||||
#endif // XP_PC && !XP_OS2
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
static void GetCurrentWorkingDirectory(nsFileSpec& aFileSpec)
|
||||
|
@ -156,7 +161,7 @@ static void GetCurrentWorkingDirectory(nsFileSpec& aFileSpec)
|
|||
static void GetCurrentProcessDirectory(nsFileSpec& aFileSpec)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
#ifdef XP_PC
|
||||
#if defined (XP_PC) && !defined (XP_OS2)
|
||||
char buf[MAX_PATH];
|
||||
if ( ::GetModuleFileName(0, buf, sizeof(buf)) ) {
|
||||
// chop of the executable name by finding the rightmost backslash
|
||||
|
@ -168,6 +173,17 @@ static void GetCurrentProcessDirectory(nsFileSpec& aFileSpec)
|
|||
return;
|
||||
}
|
||||
|
||||
#elif defined(XP_OS2)
|
||||
PPIB ppib;
|
||||
PTIB ptib;
|
||||
char buffer[CCHMAXPATH];
|
||||
DosGetInfoBlocks( &ptib, &ppib);
|
||||
DosQueryModuleName( ppib->pib_hmte, CCHMAXPATH, buffer);
|
||||
*strrchr( buffer, '\\') = '\0'; // XXX DBCS misery
|
||||
aFileSpec = buffer;
|
||||
return;
|
||||
|
||||
|
||||
#elif defined(XP_MAC)
|
||||
// get info for the the current process to determine the directory
|
||||
// its located in
|
||||
|
@ -308,7 +324,7 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect
|
|||
{
|
||||
|
||||
case OS_DriveDirectory:
|
||||
#ifdef XP_PC
|
||||
#if defined (XP_PC) && !defined (XP_OS2)
|
||||
{
|
||||
char path[_MAX_PATH];
|
||||
PRInt32 len = GetWindowsDirectory( path, _MAX_PATH );
|
||||
|
@ -319,6 +335,20 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect
|
|||
}
|
||||
*this = MakeUpperCase(path);
|
||||
}
|
||||
#elif defined(XP_OS2)
|
||||
{
|
||||
// printf( "*** Warning warning OS_DriveDirectory called for");
|
||||
|
||||
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 OS_DriveDirectory: %s\n", buffer);
|
||||
#endif
|
||||
}
|
||||
#elif defined(XP_MAC)
|
||||
{
|
||||
*this = kVolumeRootFolderType;
|
||||
|
@ -330,12 +360,26 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect
|
|||
|
||||
|
||||
case OS_TemporaryDirectory:
|
||||
#ifdef XP_PC
|
||||
#if defined (XP_PC) && !defined (XP_OS2)
|
||||
{
|
||||
char path[_MAX_PATH];
|
||||
DWORD len = GetTempPath(_MAX_PATH, path);
|
||||
*this = MakeUpperCase(path);
|
||||
}
|
||||
#elif defined(XP_OS2)
|
||||
{
|
||||
char buffer[CCHMAXPATH] = "";
|
||||
char *c = getenv( "TMP");
|
||||
if( c) strcpy( buffer, c);
|
||||
else
|
||||
{
|
||||
c = getenv( "TEMP");
|
||||
if( c) strcpy( buffer, c);
|
||||
}
|
||||
if( c) *this = buffer;
|
||||
// use exe's directory if not set
|
||||
else GetCurrentProcessDirectory(*this);
|
||||
}
|
||||
#elif defined(XP_MAC)
|
||||
*this = kTemporaryFolderType;
|
||||
|
||||
|
@ -503,7 +547,7 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect
|
|||
break;
|
||||
#endif
|
||||
|
||||
#ifdef XP_PC
|
||||
#if defined (XP_PC) && !defined (XP_OS2)
|
||||
case Win_SystemDirectory:
|
||||
{
|
||||
char path[_MAX_PATH];
|
||||
|
@ -673,7 +717,7 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect
|
|||
GetWindowsFolder(CSIDL_PRINTHOOD, *this);
|
||||
break;
|
||||
}
|
||||
#endif // XP_PC
|
||||
#endif // XP_PC && !XP_OS2
|
||||
|
||||
#ifdef XP_UNIX
|
||||
case Unix_LocalDirectory:
|
||||
|
@ -747,7 +791,20 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect
|
|||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef XP_OS2
|
||||
case OS2_SystemDirectory:
|
||||
{
|
||||
ULONG ulBootDrive = 0;
|
||||
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);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -100,6 +100,8 @@ class NS_COM nsSpecialSystemDirectory : public nsFileSpec
|
|||
, BeOS_HomeDirectory = 402
|
||||
, BeOS_DesktopDirectory = 403
|
||||
, BeOS_SystemDirectory = 404
|
||||
|
||||
, OS2_SystemDirectory = 501
|
||||
};
|
||||
|
||||
//nsSpecialSystemDirectory();
|
||||
|
|
|
@ -90,11 +90,11 @@
|
|||
//========================================================================================
|
||||
// Compiler-specific macros, as needed
|
||||
//========================================================================================
|
||||
#if !defined(NS_USING_NAMESPACE) && (defined(__MWERKS__) || defined(XP_PC))
|
||||
#if !defined(NS_USING_NAMESPACE) && (defined(__MWERKS__) || (defined(XP_PC) && !defined(XP_OS2)))
|
||||
#define NS_USING_NAMESPACE
|
||||
#endif
|
||||
|
||||
#if !defined(NS_USING_STL) && (defined(__MWERKS__) || defined(XP_PC))
|
||||
#if !defined(NS_USING_STL) && (defined(__MWERKS__) || (defined(XP_PC) && !defined(XP_OS2)))
|
||||
#define NS_USING_STL
|
||||
#endif
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче