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;
FAppSettings : TCefSettings;
FDeviceScaleFactor : single;
FCheckDevToolsResources : boolean;
procedure SetFrameworkDirPath(const aValue : ustring);
procedure SetResourcesDirPath(const aValue : ustring);
@ -267,6 +268,7 @@ type
property MuteAudio : boolean read FMuteAudio write FMuteAudio;
property ReRaiseExceptions : boolean read FReRaiseExceptions write FReRaiseExceptions;
property DeviceScaleFactor : single read FDeviceScaleFactor;
property CheckDevToolsResources : boolean read FCheckDevToolsResources write FCheckDevToolsResources;
end;
TCefAppOwn = class(TCefBaseRefCountedOwn, ICefApp)
@ -369,6 +371,7 @@ begin
FShowMessageDlg := True;
FSetCurrentDir := False;
FUpdateChromeVer := aUpdateChromeVer;
FCheckDevToolsResources := True;
UpdateDeviceScaleFactor;
@ -549,7 +552,7 @@ begin
end;
if not(CheckResources(FResourcesDirPath)) then
if not(CheckResources(FResourcesDirPath, FCheckDevToolsResources)) then
begin
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 GetAbsoluteDirPath(const aSrcPath : string; var aRsltPath : 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 CheckDLLVersion(const aDLLFile : string; aMajor, aMinor, aRelease, aBuild : uint16) : boolean;
@ -696,7 +696,7 @@ begin
aRsltPath := '';
end;
function CheckResources(const aResourcesDirPath : string) : boolean;
function CheckResources(const aResourcesDirPath : string; aCheckDevResources: boolean) : boolean;
var
TempDir : string;
begin
@ -710,7 +710,7 @@ begin
FileExists(TempDir + 'cef_100_percent.pak') and
FileExists(TempDir + 'cef_200_percent.pak') and
FileExists(TempDir + 'cef_extensions.pak') and
FileExists(TempDir + 'devtools_resources.pak');
(not aCheckDevResources or FileExists(TempDir + 'devtools_resources.pak'));
except
on e : exception do
if CustomExceptionHandler('CheckResources', e) then raise;