فهرست منبع

FIX: Use case insensitive compare when necessary (fixes #1029)

Alexander Koblov 2 سال پیش
والد
کامیت
1f5b10c8ad

+ 2 - 2
components/doublecmd/dcosutils.pas

@@ -1488,11 +1488,11 @@ end;
 function mbCompareFileNames(const FileName1, FileName2: String): Boolean; inline;
 {$IF DEFINED(WINDOWS) OR DEFINED(DARWIN)}
 begin
-  Result:= (WideCompareText(CeUtf8ToUtf16(FileName1), CeUtf8ToUtf16(FileName2)) = 0);
+  Result:= (UnicodeCompareText(CeUtf8ToUtf16(FileName1), CeUtf8ToUtf16(FileName2)) = 0);
 end;
 {$ELSE}
 begin
-  Result:= (WideCompareStr(CeUtf8ToUtf16(FileName1), CeUtf8ToUtf16(FileName2)) = 0);
+  Result:= (UnicodeCompareStr(CeUtf8ToUtf16(FileName1), CeUtf8ToUtf16(FileName2)) = 0);
 end;
 {$ENDIF}
 

+ 3 - 3
components/doublecmd/dcstrutils.pas

@@ -709,7 +709,7 @@ begin
 
   if PathToCheckLength > BasePathLength then
   begin
-    if CompareStr(Copy(sPathToCheck, 1, BasePathLength), sBasePath) = 0 then
+    if mbCompareFileNames(Copy(sPathToCheck, 1, BasePathLength), sBasePath) then
     begin
       if AllowSubDirs then
         Result := True
@@ -734,9 +734,9 @@ begin
   else
     Result := AllowSame and
       (((PathToCheckLength = BasePathLength) and
-        (CompareStr(sPathToCheck, sBasePath) = 0)) or
+        (mbCompareFileNames(sPathToCheck, sBasePath))) or
        ((PathToCheckLength = BasePathLength - 1) and
-        (CompareStr(Copy(sBasePath, 1, PathToCheckLength), sPathToCheck) = 0)));
+        (mbCompareFileNames(Copy(sBasePath, 1, PathToCheckLength), sPathToCheck))));
 end;
 
 function ExtractDirLevel(const sPrefix, sPath: String): String;

+ 1 - 1
src/filesources/wcxarchive/uwcxarchivefilesource.pas

@@ -534,7 +534,7 @@ begin
         Header := TWCXHeader(AFileList.Items[I]);
         if FPS_ISDIR(Header.FileAttr) and (Length(Header.FileName) > 0) then
         begin
-          if NewDir = IncludeTrailingPathDelimiter(GetRootDir() + Header.FileName) then
+          if mbCompareFileNames(NewDir, IncludeTrailingPathDelimiter(GetRootDir() + Header.FileName)) then
             Exit(True);
         end;
       end;