* added the ability to provide the name of the xpcom-library to GeckoComponentsStartup

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1371 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
Loesje_
2010-11-04 14:24:36 +00:00
parent e7d62bd2fa
commit eee543f190
2 changed files with 30 additions and 17 deletions

View File

@ -2,7 +2,7 @@ unit GeckoInit;
interface interface
procedure GeckoComponentsStartup; procedure GeckoComponentsStartup(XPComPath: string = '');
procedure GeckoComponentsShutdown; procedure GeckoComponentsShutdown;
implementation implementation
@ -14,7 +14,7 @@ uses
var var
sInitCount: Integer = 0; sInitCount: Integer = 0;
procedure GeckoComponentsStartup(); procedure GeckoComponentsStartup(XPComPath: string = '');
var var
rv: nsresult; rv: nsresult;
@ -26,7 +26,7 @@ begin
Exit; Exit;
end; end;
rv := XRE_Startup('1.9', True, '2.0', False); rv := XRE_Startup('1.9', True, '2.0', False, XPComPath);
if NS_FAILED(rv) then if NS_FAILED(rv) then
begin begin

View File

@ -54,14 +54,16 @@ function XRE_UnloadGRE(): nsresult;
function XRE_FindAndLoadGRE(const lowerVer: PAnsiChar; function XRE_FindAndLoadGRE(const lowerVer: PAnsiChar;
lowerInclusive: PRBool; lowerInclusive: PRBool;
const upperVer: PAnsiChar; const upperVer: PAnsiChar;
upperInclusive: PRBool): nsresult; upperInclusive: PRBool;
XPComPath: string = ''): nsresult;
function XRE_GetLoadedGREPath(GREPath: PAnsiChar; function XRE_GetLoadedGREPath(GREPath: PAnsiChar;
GREPathLen: Cardinal): nsresult; GREPathLen: Cardinal): nsresult;
function XRE_Startup(const lowerVer: PAnsiChar; function XRE_Startup(const lowerVer: PAnsiChar;
lowerInclusive: PRBool; lowerInclusive: PRBool;
const upperVer: PAnsiChar; const upperVer: PAnsiChar;
upperInclusive: PRBool): nsresult; upperInclusive: PRBool;
XPComPath: string = ''): nsresult;
function XRE_Shutdown(): nsresult; function XRE_Shutdown(): nsresult;
function XRE_main(argc: integer; function XRE_main(argc: integer;
@ -265,11 +267,7 @@ begin
end; end;
lastSlash^ := #0; lastSlash^ := #0;
NS_StrLCopy(xulPath, xpcomPath, MAX_PATH); NS_StrLCopy(xulPath, xpcomPath, MAX_PATH);
{$IFDEF MSWINDOWS} NS_StrLCat(xulPath, DirectorySeparator + libxul, MAX_PATH);
NS_StrLCat(xulPath, '\' + libxul, MAX_PATH);
{$ELSE}
NS_StrLCat(xulPath, '/' + libxul, MAX_PATH);
{$ENDIF}
Result := XPCOMGlueStartup(GREPath); Result := XPCOMGlueStartup(GREPath);
if NS_FAILED(Result) then if NS_FAILED(Result) then
@ -318,15 +316,28 @@ end;
function XRE_FindAndLoadGRE(const lowerVer: PAnsiChar; function XRE_FindAndLoadGRE(const lowerVer: PAnsiChar;
lowerInclusive: PRBool; lowerInclusive: PRBool;
const upperVer: PAnsiChar; const upperVer: PAnsiChar;
upperInclusive: PRBool): nsresult; upperInclusive: PRBool;
XPComPath: string = ''): nsresult;
var var
grePath: array[0..MAX_PATH] of AnsiChar; grePath: array[0..MAX_PATH] of AnsiChar;
begin begin
Result := XRE_FindGRE(lowerVer, lowerInclusive, if XPComPath='' then
upperVer, upperInclusive, begin
grePath, MAX_PATH); Result := XRE_FindGRE(lowerVer, lowerInclusive,
if NS_FAILED(Result) then upperVer, upperInclusive,
grePath, MAX_PATH);
if NS_FAILED(Result) then
Exit;
end
else if FileExists(XPComPath) then
begin
NS_StrLCopy(GREPath, pchar(XPComPath), length(XPComPath));
end
else
begin
result := NS_ERROR_FILE_ACCESS_DENIED;
Exit; Exit;
end;
Result := XRE_LoadGRE(grePath); Result := XRE_LoadGRE(grePath);
end; end;
@ -346,7 +357,8 @@ end;
function XRE_Startup(const lowerVer: PAnsiChar; function XRE_Startup(const lowerVer: PAnsiChar;
lowerInclusive: PRBool; lowerInclusive: PRBool;
const upperVer: PAnsiChar; const upperVer: PAnsiChar;
upperInclusive: PRBool): nsresult; upperInclusive: PRBool;
XPComPath: string = ''): nsresult;
var var
grePath: array[0..MAX_PATH] of AnsiChar; grePath: array[0..MAX_PATH] of AnsiChar;
xulDir: nsILocalFile; xulDir: nsILocalFile;
@ -356,7 +368,8 @@ var
appDir: nsILocalFile; appDir: nsILocalFile;
begin begin
Result := XRE_FindAndLoadGRE(lowerVer, lowerInclusive, Result := XRE_FindAndLoadGRE(lowerVer, lowerInclusive,
upperVer, upperInclusive); upperVer, upperInclusive,
XPComPath);
if NS_FAILED(Result) then if NS_FAILED(Result) then
Exit; Exit;