diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-07-23 15:12:30 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-07-23 15:12:30 +0000 |
commit | 5a90cac874ddce946f2212aca7e5c923f86c2f6d (patch) | |
tree | 2a150c57315a0389cb020dbd98ea59113525fd5c /unicode/src | |
parent | 2c54c37a8f0a8c9ab72eb6bfd31bc5d11a074edd (diff) | |
download | usdx-5a90cac874ddce946f2212aca7e5c923f86c2f6d.tar.gz usdx-5a90cac874ddce946f2212aca7e5c923f86c2f6d.tar.xz usdx-5a90cac874ddce946f2212aca7e5c923f86c2f6d.zip |
changed implementation of WideFileExists() to improve performance
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1871 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'unicode/src')
-rw-r--r-- | unicode/src/lib/TntUnicodeControls/TntSysUtils.pas | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/unicode/src/lib/TntUnicodeControls/TntSysUtils.pas b/unicode/src/lib/TntUnicodeControls/TntSysUtils.pas index 17084f35..0b0f5c5e 100644 --- a/unicode/src/lib/TntUnicodeControls/TntSysUtils.pas +++ b/unicode/src/lib/TntUnicodeControls/TntSysUtils.pas @@ -1041,22 +1041,15 @@ var Code: Cardinal; begin Code := WideFileGetAttr(Name); - Result := (Code <> INVALID_FILE_ATTRIBUTES) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0); + Result := (Code <> INVALID_FILE_ATTRIBUTES) and ((FILE_ATTRIBUTE_DIRECTORY and Code) <> 0); end; function WideFileExists(const Name: WideString): Boolean; var - Handle: THandle; - FindData: TWin32FindDataW; + Code: Cardinal; begin - Result := False; - Handle := Tnt_FindFirstFileW(PWideChar(Name), FindData); - if Handle <> INVALID_HANDLE_VALUE then - begin - Windows.FindClose(Handle); - if (FindData.dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY) = 0 then - Result := True; - end; + Code := WideFileGetAttr(Name); + Result := (Code <> INVALID_FILE_ATTRIBUTES) and ((FILE_ATTRIBUTE_DIRECTORY and Code) = 0); end; function WideFileGetAttr(const FileName: WideString): Cardinal; |