summaryrefslogtreecommitdiff
path: root/shared/fileHandling.h
diff options
context:
space:
mode:
Diffstat (limited to 'shared/fileHandling.h')
-rw-r--r--shared/fileHandling.h36
1 files changed, 25 insertions, 11 deletions
diff --git a/shared/fileHandling.h b/shared/fileHandling.h
index 13770839..7e1b3de0 100644
--- a/shared/fileHandling.h
+++ b/shared/fileHandling.h
@@ -4,8 +4,8 @@
// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) *
// **************************************************************************
//
-#ifndef RECYCLER2_H_INCLUDED
-#define RECYCLER2_H_INCLUDED
+#ifndef FILE_HANDLING_H_INCLUDED
+#define FILE_HANDLING_H_INCLUDED
#include "zstring.h"
#include "fileError.h"
@@ -20,18 +20,30 @@ namespace FreeFileSync
{
Zstring getFormattedDirectoryName(const Zstring& dirname);
-bool fileExists(const DefaultChar* filename); //throw() replaces wxFileExists()!
-bool dirExists(const DefaultChar* dirname); //throw() replaces wxDirExists(): optional 'cause wxDirExists treats symlinks correctly
-bool symlinkExists(const DefaultChar* objname); //throw() check if a symbolic link exists
+bool fileExists( const Zstring& filename); //throw() replaces wxFileExists()!
+bool dirExists( const Zstring& dirname); //throw() replaces wxDirExists(): optional 'cause wxDirExists treats symlinks correctly
+bool symlinkExists( const Zstring& objname); //throw() check whether a symbolic link exists
+bool somethingExists(const Zstring& objname); //throw() check whether any object with this name exists
-//check if files can be moved between two EXISTING paths (without copying)
-bool isMovable(const Zstring& pathFrom, const Zstring& pathTo); //throw()
+//check whether two folders are located on the same (logical) volume
+//left and right directories NEED NOT yet exist! volume prefix is sufficient! path may end with PATH_SEPARATOR
+enum ResponseSameVol
+{
+ VOLUME_SAME,
+ VOLUME_DIFFERENT,
+ VOLUME_CANT_SAY
+};
+ResponseSameVol onSameVolume(const Zstring& folderLeft, const Zstring& folderRight); //throw()
//optionally: copy creation/last change date, DOES NOTHING if something fails
void copyFileTimes(const Zstring& sourceDir, const Zstring& targetDir); //throw()
+//symlink handling: always evaluate target
+wxULongLong getFilesize(const Zstring& filename); //throw (FileError)
+
+
//file handling
-void removeFile(const Zstring& filename); //throw (FileError, std::logic_error)
+void removeFile(const Zstring& filename); //throw (FileError)
void removeDirectory(const Zstring& directory); //throw (FileError)
@@ -74,13 +86,15 @@ struct CopyFileCallback //callback functionality
void copyFile(const Zstring& sourceFile,
const Zstring& targetFile,
- const bool copyFileSymLinks,
+ bool copyFileSymLinks,
#ifdef FFS_WIN
ShadowCopy* shadowCopyHandler = NULL, //supply handler for making shadow copies
#endif
CopyFileCallback* callback = NULL); //throw (FileError);
-
+//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 Zstring TEMP_FILE_ENDING = DefaultStr(".ffs_tmp");
}
-#endif // RECYCLER2_H_INCLUDED
+#endif //FILE_HANDLING_H_INCLUDED
bgstack15