improve: allow to ignore devtools_resources.pak absence

Some projects does not use DevTools, so there is no need to include
devtools_resources.pak into a project, but CEF4Delphi requires it.

Make able to ignore devtools_resources.pak absence.
This commit is contained in:
Alexey Shumkin 2017-10-24 18:01:26 +03:00
parent 0e705a3aa2
commit 365bd1eeaf
2 changed files with 7 additions and 4 deletions

View File

@ -131,6 +131,7 @@ type
FRenderProcessHandler : ICefRenderProcessHandler; FRenderProcessHandler : ICefRenderProcessHandler;
FAppSettings : TCefSettings; FAppSettings : TCefSettings;
FDeviceScaleFactor : single; FDeviceScaleFactor : single;
FCheckDevToolsResources : boolean;
procedure SetFrameworkDirPath(const aValue : ustring); procedure SetFrameworkDirPath(const aValue : ustring);
procedure SetResourcesDirPath(const aValue : ustring); procedure SetResourcesDirPath(const aValue : ustring);
@ -267,6 +268,7 @@ type
property MuteAudio : boolean read FMuteAudio write FMuteAudio; property MuteAudio : boolean read FMuteAudio write FMuteAudio;
property ReRaiseExceptions : boolean read FReRaiseExceptions write FReRaiseExceptions; property ReRaiseExceptions : boolean read FReRaiseExceptions write FReRaiseExceptions;
property DeviceScaleFactor : single read FDeviceScaleFactor; property DeviceScaleFactor : single read FDeviceScaleFactor;
property CheckDevToolsResources : boolean read FCheckDevToolsResources write FCheckDevToolsResources;
end; end;
TCefAppOwn = class(TCefBaseRefCountedOwn, ICefApp) TCefAppOwn = class(TCefBaseRefCountedOwn, ICefApp)
@ -369,6 +371,7 @@ begin
FShowMessageDlg := True; FShowMessageDlg := True;
FSetCurrentDir := False; FSetCurrentDir := False;
FUpdateChromeVer := aUpdateChromeVer; FUpdateChromeVer := aUpdateChromeVer;
FCheckDevToolsResources := True;
UpdateDeviceScaleFactor; UpdateDeviceScaleFactor;
@ -549,7 +552,7 @@ begin
end; end;
if not(CheckResources(FResourcesDirPath)) then if not(CheckResources(FResourcesDirPath, FCheckDevToolsResources)) then
begin begin
TempString := 'CEF resources missing !' + CRLF + CRLF; TempString := 'CEF resources missing !' + CRLF + CRLF;

View File

@ -138,7 +138,7 @@ function GetDLLVersion(const aDLLFile : string; var aVersionInfo : TFileVersion
function SplitLongString(aSrcString : string) : string; function SplitLongString(aSrcString : string) : string;
function GetAbsoluteDirPath(const aSrcPath : string; var aRsltPath : string) : boolean; function GetAbsoluteDirPath(const aSrcPath : string; var aRsltPath : string) : boolean;
function CheckLocales(const aLocalesDirPath : string) : boolean; function CheckLocales(const aLocalesDirPath : string) : boolean;
function CheckResources(const aResourcesDirPath : string) : boolean; function CheckResources(const aResourcesDirPath : string; aCheckDevResources: boolean) : boolean;
function CheckDLLs(const aFrameworkDirPath : string) : boolean; function CheckDLLs(const aFrameworkDirPath : string) : boolean;
function CheckDLLVersion(const aDLLFile : string; aMajor, aMinor, aRelease, aBuild : uint16) : boolean; function CheckDLLVersion(const aDLLFile : string; aMajor, aMinor, aRelease, aBuild : uint16) : boolean;
@ -696,7 +696,7 @@ begin
aRsltPath := ''; aRsltPath := '';
end; end;
function CheckResources(const aResourcesDirPath : string) : boolean; function CheckResources(const aResourcesDirPath : string; aCheckDevResources: boolean) : boolean;
var var
TempDir : string; TempDir : string;
begin begin
@ -710,7 +710,7 @@ begin
FileExists(TempDir + 'cef_100_percent.pak') and FileExists(TempDir + 'cef_100_percent.pak') and
FileExists(TempDir + 'cef_200_percent.pak') and FileExists(TempDir + 'cef_200_percent.pak') and
FileExists(TempDir + 'cef_extensions.pak') and FileExists(TempDir + 'cef_extensions.pak') and
FileExists(TempDir + 'devtools_resources.pak'); (not aCheckDevResources or FileExists(TempDir + 'devtools_resources.pak'));
except except
on e : exception do on e : exception do
if CustomExceptionHandler('CheckResources', e) then raise; if CustomExceptionHandler('CheckResources', e) then raise;