diff options
Diffstat (limited to 'zen/file_access.h')
-rw-r--r-- | zen/file_access.h | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/zen/file_access.h b/zen/file_access.h index 0dfb650e..4b1c31dd 100644 --- a/zen/file_access.h +++ b/zen/file_access.h @@ -14,10 +14,10 @@ namespace zen { -bool fileExists (const Zstring& filepath); //noexcept; check whether file or file-symlink exists -bool dirExists (const Zstring& dirpath ); //noexcept; check whether directory or dir-symlink exists -bool symlinkExists (const Zstring& linkname); //noexcept; check whether a symbolic link exists -bool somethingExists(const Zstring& objname ); //noexcept; check whether any object with this name exists +bool fileExists (const Zstring& filePath); //noexcept; check whether file or file-symlink exists +bool dirExists (const Zstring& dirPath ); //noexcept; check whether directory or dir-symlink exists +bool symlinkExists (const Zstring& linkPath); //noexcept; check whether a symbolic link exists +bool somethingExists(const Zstring& itemPath); //noexcept; check whether any object with this name exists enum class ProcSymlink { @@ -25,27 +25,29 @@ enum class ProcSymlink FOLLOW }; -void setFileTime(const Zstring& filepath, std::int64_t modificationTime, ProcSymlink procSl); //throw FileError +void setFileTime(const Zstring& filePath, std::int64_t modificationTime, ProcSymlink procSl); //throw FileError //symlink handling: always evaluate target -std::uint64_t getFilesize(const Zstring& filepath); //throw FileError +std::uint64_t getFilesize(const Zstring& filePath); //throw FileError std::uint64_t getFreeDiskSpace(const Zstring& path); //throw FileError, returns 0 if not available -bool removeFile(const Zstring& filepath); //throw FileError; return "false" if file is not existing -void removeDirectory(const Zstring& directory, //throw FileError - const std::function<void (const Zstring& filepath)>& onBeforeFileDeletion = nullptr, //optional; - const std::function<void (const Zstring& dirpath )>& onBeforeDirDeletion = nullptr); //one call for each *existing* object! +bool removeFile(const Zstring& filePath); //throw FileError; return "false" if file is not existing + +void removeDirectorySimple(const Zstring& dirPath); //throw FileError + +void removeDirectoryRecursively(const Zstring& dirPath); //throw FileError //rename file or directory: no copying!!! void renameFile(const Zstring& itemPathOld, const Zstring& itemPathNew); //throw FileError, ErrorDifferentVolume, ErrorTargetExisting bool supportsPermissions(const Zstring& dirpath); //throw FileError, dereferences symlinks -//if parent directory not existing: create recursively: -void makeNewDirectory(const Zstring& directory); //throw FileError, ErrorTargetExisting +//- no error if already existing +//- create recursively if parent directory is not existing +void makeDirectoryRecursively(const Zstring& dirpath); //throw FileError //fail if already existing or parent directory not existing: -//directory should not end with path separator +//source path is optional (may be empty) void copyNewDirectory(const Zstring& sourcePath, const Zstring& targetPath, bool copyFilePermissions); //throw FileError, ErrorTargetExisting, ErrorTargetPathMissing void copySymlink(const Zstring& sourceLink, const Zstring& targetLink, bool copyFilePermissions); //throw FileError |