зеркало из https://github.com/mozilla/pjs.git
Bug 316857 - in win/unix stub, allow finding a private XULRunner in the "xulrunner" subdirectory, r=darin
This commit is contained in:
Родитель
72781fc64e
Коммит
ed858c5347
|
@ -42,10 +42,12 @@
|
||||||
|
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <io.h>
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#define PATH_SEPARATOR_CHAR '\\'
|
#define PATH_SEPARATOR_CHAR '\\'
|
||||||
#define XULRUNNER_BIN "xulrunner.exe"
|
#define XULRUNNER_BIN "xulrunner.exe"
|
||||||
#include "nsWindowsRestart.cpp"
|
#include "nsWindowsRestart.cpp"
|
||||||
|
#define R_OK 04
|
||||||
#else
|
#else
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -110,7 +112,14 @@ main(int argc, char **argv)
|
||||||
if (!lastSlash)
|
if (!lastSlash)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
strcpy(lastSlash + 1, "application.ini");
|
*(++lastSlash) = '\0';
|
||||||
|
|
||||||
|
char greDir[MAXPATHLEN];
|
||||||
|
snprintf(greDir, sizeof(greDir),
|
||||||
|
"%sxulrunner" XPCOM_FILE_PATH_SEPARATOR XPCOM_DLL,
|
||||||
|
iniPath);
|
||||||
|
|
||||||
|
strncpy(lastSlash, "application.ini", sizeof(iniPath) - (lastSlash - iniPath));
|
||||||
|
|
||||||
nsINIParser parser;
|
nsINIParser parser;
|
||||||
rv = parser.Init(iniPath);
|
rv = parser.Init(iniPath);
|
||||||
|
@ -119,41 +128,42 @@ main(int argc, char **argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
char greDir[MAXPATHLEN];
|
if (access(greDir, R_OK) != 0) {
|
||||||
char minVersion[VERSION_MAXLEN];
|
char minVersion[VERSION_MAXLEN];
|
||||||
|
|
||||||
// If a gecko maxVersion is not specified, we assume that the app uses only
|
// If a gecko maxVersion is not specified, we assume that the app uses only
|
||||||
// frozen APIs, and is therefore compatible with any xulrunner 1.x.
|
// frozen APIs, and is therefore compatible with any xulrunner 1.x.
|
||||||
char maxVersion[VERSION_MAXLEN] = "2";
|
char maxVersion[VERSION_MAXLEN] = "2";
|
||||||
|
|
||||||
GREVersionRange range = {
|
GREVersionRange range = {
|
||||||
minVersion,
|
minVersion,
|
||||||
PR_TRUE,
|
PR_TRUE,
|
||||||
maxVersion,
|
maxVersion,
|
||||||
PR_FALSE
|
PR_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
rv = parser.GetString("Gecko", "MinVersion", minVersion, sizeof(minVersion));
|
rv = parser.GetString("Gecko", "MinVersion", minVersion, sizeof(minVersion));
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"The application.ini does not specify a [Gecko] MinVersion\n");
|
"The application.ini does not specify a [Gecko] MinVersion\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = parser.GetString("Gecko", "MaxVersion", maxVersion, sizeof(maxVersion));
|
rv = parser.GetString("Gecko", "MaxVersion", maxVersion, sizeof(maxVersion));
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
range.upperInclusive = PR_TRUE;
|
range.upperInclusive = PR_TRUE;
|
||||||
|
|
||||||
rv = GRE_GetGREPathWithProperties(&range, 1, nsnull, 0,
|
rv = GRE_GetGREPathWithProperties(&range, 1, nsnull, 0,
|
||||||
greDir, sizeof(greDir));
|
greDir, sizeof(greDir));
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
// XXXbsmedberg: Do something much smarter here: notify the
|
// XXXbsmedberg: Do something much smarter here: notify the
|
||||||
// user/offer to download/?
|
// user/offer to download/?
|
||||||
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Could not find compatible GRE between version %s and %s.\n",
|
"Could not find compatible GRE between version %s and %s.\n",
|
||||||
range.lower, range.upper);
|
range.lower, range.upper);
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lastSlash = strrchr(greDir, PATH_SEPARATOR_CHAR);
|
lastSlash = strrchr(greDir, PATH_SEPARATOR_CHAR);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче