From aa85fae43a8efd4f8c9cbc4c54c15303ea33dad6 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 20 May 2023 00:11:26 +0200 Subject: [PATCH] water: cleanup file related code, add winMyDocuments property Signed-off-by: falkTX --- source/modules/water/files/File.cpp | 4 ++++ source/modules/water/files/File.h | 20 +------------------ .../modules/water/files/FileInputStream.cpp | 3 +++ source/modules/water/text/String.h | 4 ++-- 4 files changed, 10 insertions(+), 21 deletions(-) diff --git a/source/modules/water/files/File.cpp b/source/modules/water/files/File.cpp index 55ca34f3c..06f2ff148 100644 --- a/source/modules/water/files/File.cpp +++ b/source/modules/water/files/File.cpp @@ -1158,6 +1158,10 @@ File File::getSpecialLocation (const SpecialLocationType type) csidlType = CSIDL_PROGRAM_FILES_COMMON; break; + case winMyDocuments: + csidlType = CSIDL_MYDOCUMENTS; + break; + default: wassertfalse; // unknown type? return File(); diff --git a/source/modules/water/files/File.h b/source/modules/water/files/File.h index 0f3115444..5cae96223 100644 --- a/source/modules/water/files/File.h +++ b/source/modules/water/files/File.h @@ -347,22 +347,6 @@ public: */ bool isHidden() const; - /** Returns a unique identifier for the file, if one is available. - - Depending on the OS and file-system, this may be a unix inode number or - a win32 file identifier, or 0 if it fails to find one. The number will - be unique on the filesystem, but not globally. - */ - uint64 getFileIdentifier() const; - - /** If possible, this will try to create a version string for the given file. - - The OS may be able to look at the file and give a version for it - e.g. with - executables, bundles, dlls, etc. If no version is available, this will - return an empty string. - */ - String getVersion() const; - //============================================================================== /** Creates an empty file if it doesn't already exist. @@ -665,7 +649,7 @@ public: hostApplicationPath, /** Windows specific paths */ - winAppData, winProgramFiles, winCommonProgramFiles + winAppData, winProgramFiles, winCommonProgramFiles, winMyDocuments }; /** Finds the location of a special type of file or directory, such as a home folder or @@ -786,8 +770,6 @@ private: bool copyInternal (const File&) const; bool moveInternal (const File&) const; bool replaceInternal (const File&) const; - bool setFileTimesInternal (int64 m, int64 a, int64 c) const; - void getFileTimesInternal (int64& m, int64& a, int64& c) const; bool setFileReadOnlyInternal (bool) const; bool setFileExecutableInternal (bool) const; }; diff --git a/source/modules/water/files/FileInputStream.cpp b/source/modules/water/files/FileInputStream.cpp index 04bd284d8..22fe2499e 100644 --- a/source/modules/water/files/FileInputStream.cpp +++ b/source/modules/water/files/FileInputStream.cpp @@ -106,7 +106,10 @@ size_t FileInputStream::readInternal (void* buffer, size_t numBytes) { DWORD actualNum = 0; if (! ReadFile ((HANDLE) fileHandle, buffer, (DWORD) numBytes, &actualNum, 0)) + { status = getResultForLastError(); + actualNum = 0; + } return (size_t) actualNum; } diff --git a/source/modules/water/text/String.h b/source/modules/water/text/String.h index 4dc923886..69f8e8986 100644 --- a/source/modules/water/text/String.h +++ b/source/modules/water/text/String.h @@ -990,7 +990,7 @@ public: To find out how many bytes you need to store this string as UTF-8, you can call CharPointer_UTF8::getBytesRequiredFor (myString.getCharPointer()) - @see toRawUTF8, getCharPointer, toUTF16, toUTF32 + @see toRawUTF8, getCharPointer, toUTF16 */ CharPointer_UTF8 toUTF8() const; @@ -1008,7 +1008,7 @@ public: To find out how many bytes you need to store this string as UTF-8, you can call CharPointer_UTF8::getBytesRequiredFor (myString.getCharPointer()) - @see getCharPointer, toUTF8, toUTF16, toUTF32 + @see getCharPointer, toUTF8, toUTF16 */ const char* toRawUTF8() const;