r=pedemont, sr=blizzard (platform specific), a=mkaply OS/2 only - fully qualify turbo daemon before trying to launch git-svn-id: svn://10.0.0.236/branches/AVIARY_1_0_20040515_BRANCH@157857 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -358,7 +358,7 @@ public:
|
||||
// console.
|
||||
// On OS/2, we use the return from CheckConsole to determine
|
||||
// whether or not to use the OS/2 specific turbo mode
|
||||
nsresult CheckConsole();
|
||||
PRBool CheckConsole();
|
||||
|
||||
private:
|
||||
static HDDEDATA APIENTRY HandleDDENotification( ULONG idInst,
|
||||
@@ -641,9 +641,14 @@ void ThreadProc(void *splashScreen) {
|
||||
|
||||
PRBool gAbortServer = PR_FALSE;
|
||||
|
||||
nsresult
|
||||
PRBool
|
||||
nsNativeAppSupportOS2::CheckConsole() {
|
||||
nsresult rv = NS_OK;
|
||||
CHAR pszAppPath[CCHMAXPATH];
|
||||
PPIB ppib;
|
||||
PTIB ptib;
|
||||
DosGetInfoBlocks(&ptib, &ppib);
|
||||
DosQueryModuleName(ppib->pib_hmte, CCHMAXPATH, pszAppPath);
|
||||
*strrchr(pszAppPath, '\\') = '\0'; // XXX DBCS misery
|
||||
|
||||
for ( int i = 1; i < __argc; i++ ) {
|
||||
if ( strcmp( "-console", __argv[i] ) == 0
|
||||
@@ -657,27 +662,30 @@ nsNativeAppSupportOS2::CheckConsole() {
|
||||
strcmp( "-server", __argv[i] ) == 0
|
||||
||
|
||||
strcmp( "/server", __argv[i] ) == 0 ) {
|
||||
|
||||
struct stat st;
|
||||
int statrv = stat(TURBOD, &st);
|
||||
CHAR pszTurboPath[CCHMAXPATH];
|
||||
|
||||
strcpy(pszTurboPath, pszAppPath);
|
||||
strcat(pszTurboPath, "\\");
|
||||
strcat(pszTurboPath, TURBOD);
|
||||
int statrv = stat(pszTurboPath, &st);
|
||||
|
||||
/* If we can't find the turbo EXE, use the Mozilla turbo */
|
||||
if (statrv == 0) {
|
||||
RESULTCODES rcodes;
|
||||
APIRET rc;
|
||||
CHAR pszArgString[CCHMAXPATH];
|
||||
strcpy(pszArgString, TURBOD);
|
||||
|
||||
strcpy(pszArgString, pszTurboPath);
|
||||
strcat(pszArgString, " -l -p ");
|
||||
strcat(pszArgString, __argv[0]);
|
||||
char *pchar = strrchr(pszArgString, '\\');
|
||||
pchar++;
|
||||
*pchar = '\0';
|
||||
pszArgString[strlen(TURBOD)] = '\0';
|
||||
strcat(pszArgString, pszAppPath);
|
||||
pszArgString[strlen(pszTurboPath)] = '\0';
|
||||
|
||||
rc = DosExecPgm(NULL,0,EXEC_BACKGROUND,
|
||||
pszArgString,
|
||||
0, &rcodes,
|
||||
TURBOD);
|
||||
rv = NS_ERROR_FAILURE;
|
||||
DosExecPgm(NULL,0,EXEC_BACKGROUND,
|
||||
pszArgString,
|
||||
0, &rcodes,
|
||||
pszTurboPath);
|
||||
return PR_FALSE; /* Don't start the app */
|
||||
} else {
|
||||
// Start in server mode (and suppress splash screen).
|
||||
mServerMode = PR_TRUE;
|
||||
@@ -691,23 +699,29 @@ nsNativeAppSupportOS2::CheckConsole() {
|
||||
for ( int j = 1; j < __argc; j++ ) {
|
||||
if (strcmp("-killAll", __argv[j]) == 0 || strcmp("/killAll", __argv[j]) == 0 ||
|
||||
strcmp("-kill", __argv[j]) == 0 || strcmp("/kill", __argv[j]) == 0) {
|
||||
|
||||
struct stat st;
|
||||
int statrv = stat(TURBOD, &st);
|
||||
CHAR pszTurboPath[CCHMAXPATH];
|
||||
|
||||
strcpy(pszTurboPath, pszAppPath);
|
||||
strcat(pszTurboPath, "\\");
|
||||
strcat(pszTurboPath, TURBOD);
|
||||
int statrv = stat(pszTurboPath, &st);
|
||||
|
||||
/* If we can't find the turbo EXE, use the Mozilla turbo */
|
||||
if (statrv == 0) {
|
||||
RESULTCODES rcodes;
|
||||
APIRET rc;
|
||||
CHAR pszArgString[CCHMAXPATH];
|
||||
strcpy(pszArgString, TURBOD);
|
||||
|
||||
strcpy(pszArgString, pszTurboPath);
|
||||
strcat(pszArgString, " -u");
|
||||
pszArgString[strlen(TURBOD)] = '\0';
|
||||
pszArgString[strlen(pszTurboPath)] = '\0';
|
||||
|
||||
rc = DosExecPgm(NULL,0,EXEC_BACKGROUND,
|
||||
pszArgString,
|
||||
0, &rcodes,
|
||||
TURBOD);
|
||||
rv = NS_ERROR_FAILURE;
|
||||
DosExecPgm(NULL,0,EXEC_BACKGROUND,
|
||||
pszArgString,
|
||||
0, &rcodes,
|
||||
pszTurboPath);
|
||||
return PR_FALSE; /* Don't start the app */
|
||||
} else {
|
||||
gAbortServer = PR_TRUE;
|
||||
}
|
||||
@@ -715,7 +729,7 @@ nsNativeAppSupportOS2::CheckConsole() {
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
return PR_TRUE; /* Start the app */
|
||||
}
|
||||
|
||||
|
||||
@@ -726,7 +740,9 @@ NS_CreateNativeAppSupport( nsINativeAppSupport **aResult ) {
|
||||
nsNativeAppSupportOS2 *pNative = new nsNativeAppSupportOS2;
|
||||
if ( pNative ) {
|
||||
// Check for dynamic console creation request.
|
||||
if NS_FAILED(pNative->CheckConsole()) {
|
||||
// If CheckConsole returns PR_FALSE, we should
|
||||
// start the turbo daemon and close the app.
|
||||
if (pNative->CheckConsole() == PR_FALSE) {
|
||||
delete pNative;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user