From 181e410434083a28677ffa71bfcf4b8bcaf026db Mon Sep 17 00:00:00 2001 From: Bart <9132501-flyingsheep@users.noreply.gitlab.com> Date: Sun, 31 Oct 2021 17:27:04 +0100 Subject: [PATCH] LazUtils: Masks: don not disable ranges and sets in TWindowsMask, and do not compile the mask in the constructor, so the constructor won't fail if a mask is invalid. --- components/lazutils/masks.pas | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/components/lazutils/masks.pas b/components/lazutils/masks.pas index c9f6d8bdd4..12714538a6 100644 --- a/components/lazutils/masks.pas +++ b/components/lazutils/masks.pas @@ -1162,7 +1162,10 @@ begin fWindowsQuirkAllowed:=aWindowsQuirksAllowed; fWindowsMask:=aMask; inherited Create(aMask,aCaseSensitive,aOpcodesAllowed); + //don't compile on create: we do NOT want a crash in the constructor + { Compile; + } end; procedure TWindowsMaskUTF8.Compile; @@ -1184,6 +1187,7 @@ procedure TWindowsMaskUTF8.Compile; Result:=aMask; end; + { function EscapeSpecialChars(const aString: String): String; var j: integer; @@ -1196,7 +1200,7 @@ procedure TWindowsMaskUTF8.Compile; end; end; end; - + } var lFileNameMask: String; lExtensionMask: String; @@ -1241,9 +1245,11 @@ begin end; end; + //Don't disable ranges for Windows + { lFileNameMask:=EscapeSpecialChars(lFileNameMask); lExtensionMask:=EscapeSpecialChars(lExtensionMask); - + } // Quirk "file???.ab?" matches "file1.ab1" and "file123.ab" if wqFilenameEnd in fWindowsQuirkAllowed then begin lFileNameMask:=OptionalQMarksAtEnd(lFileNameMask);