diff options
author | Daniel Wilhelm <daniel@wili.li> | 2015-10-02 14:55:19 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2015-10-02 14:55:19 +0200 |
commit | 46fc289a8776ba253e97d01d6948fb1031ea1973 (patch) | |
tree | b16a99c60f21b04c001f29862bf2ee16ae3a0e00 /zen/file_access.h | |
parent | 6.15 (diff) | |
download | FreeFileSync-46fc289a8776ba253e97d01d6948fb1031ea1973.tar.gz FreeFileSync-46fc289a8776ba253e97d01d6948fb1031ea1973.tar.bz2 FreeFileSync-46fc289a8776ba253e97d01d6948fb1031ea1973.zip |
7.0
Diffstat (limited to 'zen/file_access.h')
-rw-r--r-- | zen/file_access.h | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/zen/file_access.h b/zen/file_access.h index bd1b0168..0dfb650e 100644 --- a/zen/file_access.h +++ b/zen/file_access.h @@ -29,7 +29,7 @@ void setFileTime(const Zstring& filepath, std::int64_t modificationTime, ProcSym //symlink handling: always evaluate target std::uint64_t getFilesize(const Zstring& filepath); //throw FileError -std::uint64_t getFreeDiskSpace(const Zstring& path); //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 @@ -37,17 +37,18 @@ void removeDirectory(const Zstring& directory, //throw FileError const std::function<void (const Zstring& dirpath )>& onBeforeDirDeletion = nullptr); //one call for each *existing* object! //rename file or directory: no copying!!! -void renameFile(const Zstring& oldName, const Zstring& newName); //throw FileError, ErrorDifferentVolume, ErrorTargetExisting +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 makeDirectory(const Zstring& directory, bool failIfExists = false); //throw FileError, ErrorTargetExisting +void makeNewDirectory(const Zstring& directory); //throw FileError, ErrorTargetExisting //fail if already existing or parent directory not existing: //directory should not end with path separator -//templateDir may be empty -void makeDirectoryPlain(const Zstring& directory, const Zstring& templateDir, bool copyFilePermissions); //throw FileError, ErrorTargetExisting, ErrorTargetPathMissing +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 struct InSyncAttributes { @@ -57,24 +58,9 @@ struct InSyncAttributes FileId targetFileId; }; -void copyFile(const Zstring& sourceFile, //throw FileError, ErrorFileLocked (Windows-only) - const Zstring& targetFile, //symlink handling: dereference source - bool copyFilePermissions, - bool transactionalCopy, - //if target is existing user needs to implement deletion: copyFile() NEVER overwrites target if already existing! - //if transactionalCopy == true, full read access on source had been proven at this point, so it's safe to delete it. - const std::function<void()>& onDeleteTargetFile, //may be nullptr; may throw! - //accummulated delta != file size! consider ADS, sparse, compressed files - const std::function<void(std::int64_t bytesDelta)>& onUpdateCopyStatus, //may be nullptr; may throw! - - InSyncAttributes* newAttrib = nullptr); //return current attributes at the time of copy - -//Note: it MAY happen that copyFile() leaves temp files behind, e.g. temporary network drop. -// => clean them up at an appropriate time (automatically set sync directions to delete them). They have the following ending: - -const Zchar TEMP_FILE_ENDING[] = Zstr(".ffs_tmp"); //don't use Zstring as global constant: avoid static initialization order problem in global namespace! - -void copySymlink(const Zstring& sourceLink, const Zstring& targetLink, bool copyFilePermissions); //throw FileError +InSyncAttributes copyNewFile(const Zstring& sourceFile, const Zstring& targetFile, bool copyFilePermissions, //throw FileError, ErrorTargetExisting, ErrorFileLocked + //accummulated delta != file size! consider ADS, sparse, compressed files + const std::function<void(std::int64_t bytesDelta)>& onUpdateCopyStatus); //may be nullptr; throw X! } #endif //FILE_ACCESS_H_8017341345614857 |