From 365bd1eeaf09b583025eb92db59e4848f5e560ef Mon Sep 17 00:00:00 2001 From: Alexey Shumkin Date: Tue, 24 Oct 2017 18:01:26 +0300 Subject: [PATCH] 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. --- source/uCEFApplication.pas | 5 ++++- source/uCEFMiscFunctions.pas | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/source/uCEFApplication.pas b/source/uCEFApplication.pas index 96169b2f..4c19ba7d 100644 --- a/source/uCEFApplication.pas +++ b/source/uCEFApplication.pas @@ -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; diff --git a/source/uCEFMiscFunctions.pas b/source/uCEFMiscFunctions.pas index 3bc07ebb..684e8f72 100644 --- a/source/uCEFMiscFunctions.pas +++ b/source/uCEFMiscFunctions.pas @@ -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;