From 6290d23d56d8b4d0cb2cf8268bc6ca656580b6c0 Mon Sep 17 00:00:00 2001 From: mattias Date: Sun, 28 Jun 2020 17:02:37 +0000 Subject: [PATCH] LazUtils: Prevent ForceDirectory trying to create directories with empty name. Issue #37133 git-svn-id: branches/fixes_2_0@63479 - --- components/lazutils/lazfileutils.pas | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/components/lazutils/lazfileutils.pas b/components/lazutils/lazfileutils.pas index e6ac6525b0..419f408628 100644 --- a/components/lazutils/lazfileutils.pas +++ b/components/lazutils/lazfileutils.pas @@ -538,15 +538,19 @@ begin end; function ForceDirectory(DirectoryName: string): boolean; -var i: integer; +var + i: integer; Dir: string; begin DirectoryName:=AppendPathDelim(DirectoryName); i:=1; while i<=length(DirectoryName) do begin if DirectoryName[i] in AllowDirectorySeparators then begin + // optimize paths like \foo\\bar\\foobar + while (i'') and not DirPathExists(Dir) then begin Result:=CreateDirUTF8(Dir); if not Result then exit; end; @@ -556,7 +560,6 @@ begin Result:=true; end; - function FileIsText(const AFilename: string): boolean; var FileReadable: Boolean;