aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authork-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2014-11-22 22:24:48 +0000
committerk-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2014-11-22 22:24:48 +0000
commitadb65ab322d26b262f1988d24ee5cf800e07b4bf (patch)
tree75b8d5a21bfdff7dbf4317a3a1399bf09cf59c01
parentf0c6afbad0f3e7853b693c27f65fdf761ca1c9ab (diff)
downloadusdx-adb65ab322d26b262f1988d24ee5cf800e07b4bf.tar.gz
usdx-adb65ab322d26b262f1988d24ee5cf800e07b4bf.tar.xz
usdx-adb65ab322d26b262f1988d24ee5cf800e07b4bf.zip
IPath.Equals(): dont convert paths unnecessarily. Major speedup when loading the game. Thanks to rudi_s.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@3102 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r--src/base/UPath.pas12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/base/UPath.pas b/src/base/UPath.pas
index 5a0b41fd..4ce76cf0 100644
--- a/src/base/UPath.pas
+++ b/src/base/UPath.pas
@@ -816,12 +816,24 @@ function TPathImpl.Equals(const Other: IPath; IgnoreCase: boolean): boolean;
var
SelfPath, OtherPath: UTF8String;
begin
+{$IFDEF UNIX}
+ (*
+ It looks like the code converts correctly to UTF-8 for all input data.
+ Therefore, just use those (byte) strings to perform the comparision.
+
+ NOTE: This is broken for UTF-8 strings, because file system and singstar
+ files might not be normalized. However, the previous code (see below in
+ ELSE ifdef) doesn't handle that either. So it should be fine.
+ *)
+ Result := CompareStr(Self.ToNative(), Other.ToNative()) = 0;
+{$ELSE}
SelfPath := Self.GetAbsolutePath().RemovePathDelim().ToUTF8();
OtherPath := Other.GetAbsolutePath().RemovePathDelim().ToUTF8();
if (FileSystem.IsCaseSensitive() and not IgnoreCase) then
Result := (CompareStr(SelfPath, OtherPath) = 0)
else
Result := (CompareText(SelfPath, OtherPath) = 0);
+{$ENDIF}
end;
function TPathImpl.Equals(const Other: RawByteString; IgnoreCase: boolean): boolean;