1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-01-13 10:22:04 +02:00

Lazarus/FPC compatibility fixed

This commit is contained in:
Salvador Díaz Fau 2018-09-19 13:27:23 +02:00
parent 54a88d04fa
commit 351756834e

View File

@ -1096,39 +1096,39 @@ var
TempThread : TCEFDirectoryDeleterThread;
begin
try
if (length(aDirectory) = 0) or not(DirectoryExists(aDirectory)) then exit;
TempOldDir := ExcludeTrailingPathDelimiter(aDirectory);
if (Pos(PathDelim, TempOldDir, 1) > 0) and
(length(ExtractFileName(TempOldDir)) > 0) then
begin
i := 0;
repeat
inc(i);
TempNewDir := TempOldDir + '(' + inttostr(i) + ')';
until not(DirectoryExists(TempNewDir));
if MoveFileW(PWideChar(TempOldDir + chr(0)), PWideChar(TempNewDir + chr(0))) then
begin
TempThread := TCEFDirectoryDeleterThread.Create(TempNewDir);
if (length(aDirectory) = 0) or not(DirectoryExists(aDirectory)) then exit;
TempOldDir := ExcludeTrailingPathDelimiter(aDirectory);
if (Pos(PathDelim, TempOldDir {$IFNDEF FPC}, 1{$ENDIF}) > 0) and
(length(ExtractFileName(TempOldDir)) > 0) then
begin
i := 0;
repeat
inc(i);
TempNewDir := TempOldDir + '(' + inttostr(i) + ')';
until not(DirectoryExists(TempNewDir));
if MoveFileW(PWideChar(TempOldDir + chr(0)), PWideChar(TempNewDir + chr(0))) then
begin
TempThread := TCEFDirectoryDeleterThread.Create(TempNewDir);
{$IFDEF DELPHI14_UP}
TempThread.Start;
{$ELSE}
TempThread.Resume;
{$ENDIF}
end
else
DeleteDirContents(aDirectory);
end
else
DeleteDirContents(aDirectory);
except
{$ENDIF}
end
else
DeleteDirContents(aDirectory);
end
else
DeleteDirContents(aDirectory);
except
on e : exception do
if CustomExceptionHandler('TCefApplication.RenameAndDeleteDir', e) then raise;
end;
end;
end;
end;
procedure TCefApplication.RegisterWidevineCDM;
var
@ -2309,22 +2309,23 @@ constructor TCEFDirectoryDeleterThread.Create(const aDirectory : string);
begin
inherited Create(True);
FDirectory := aDirectory;
FreeOnTerminate := True;
FDirectory := aDirectory;
FreeOnTerminate := True;
end;
procedure TCEFDirectoryDeleterThread.Execute;
begin
try
{$IFDEF DELPHI14_UP}
TDirectory.Delete(FDirectory, True);
{$ELSE}
if DeleteDirContents(FDirectory) then RemoveDir(FDirectory);
{$ENDIF}
except
try
{$IFDEF DELPHI14_UP}
TDirectory.Delete(FDirectory, True);
{$ELSE}
if DeleteDirContents(FDirectory) then RemoveDir(FDirectory);
{$ENDIF}
except
on e : exception do
if CustomExceptionHandler('TCEFDirectoryDeleterThread.Execute', e) then raise;
end;
end;
end;
end.