#include <boost/filesystem.hpp>
#include <boost/filesystem/path.hpp>
#include <string>
+#include <vector>
namespace common_installer {
FS_NONE = 0,
FS_MERGE_SKIP = (1 << 0),
FS_MERGE_OVERWRITE = (1 << 1),
- FS_COMMIT_COPY_FILE = (1 << 2)
+ FS_COMMIT_COPY_FILE = (1 << 2),
+ FS_PRESERVE_OWNERSHIP_AND_PERMISSIONS = (1 << 3)
};
FSFlag operator|(FSFlag a, FSFlag b);
bool CopyFile(const boost::filesystem::path& src,
const boost::filesystem::path& dst);
+bool RestoreBackup(const boost::filesystem::path& path);
+
+bool MakeBackup(const boost::filesystem::path& path);
+
+bool RemoveBackup(const boost::filesystem::path& path);
+
+bool RemoveAll(const boost::filesystem::path& path);
+
+bool Remove(const boost::filesystem::path& path);
+
bool MoveDir(const boost::filesystem::path& src,
const boost::filesystem::path& dst, FSFlag flags = FS_NONE);
bool MoveFile(const boost::filesystem::path& src,
- const boost::filesystem::path& dst);
+ const boost::filesystem::path& dst, bool force = false);
+
+bool BackupDir(const boost::filesystem::path& src,
+ const boost::filesystem::path& dst, const std::string& entry);
bool SetDirPermissions(const boost::filesystem::path& path,
boost::filesystem::perms permissions);
+bool SetDirOwnershipAndPermissions(const boost::filesystem::path& path,
+ boost::filesystem::perms permissions, uid_t uid,
+ gid_t gid);
+
+bool CopyOwnershipAndPermissions(const boost::filesystem::path& src,
+ const boost::filesystem::path& dst);
+
int64_t GetUnpackedPackageSize(const boost::filesystem::path& path);
int64_t GetDirectorySize(const boost::filesystem::path& path);
+bool CheckFreeSpaceAtPath(int64_t required_size,
+ const boost::filesystem::path& target_location);
+
boost::filesystem::path GenerateTmpDir(const boost::filesystem::path& app_path);
boost::filesystem::path GenerateTemporaryPath(
bool IsSubDir(const boost::filesystem::path& path,
const boost::filesystem::path& root);
+boost::filesystem::path RelativePath(const boost::filesystem::path& from,
+ const boost::filesystem::path& to);
+
+std::vector<std::string> GetDirectoryList(const boost::filesystem::path& cwd);
+
} // namespace common_installer
#endif // COMMON_UTILS_FILE_UTIL_H_