summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCore/File.h
diff options
context:
space:
mode:
authorJean-Baptiste Boric <jblbeurope@gmail.com>2021-08-15 12:24:00 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-18 20:30:46 +0200
commit8cc8d72619e408be8b792499c33b3c9cbc1dbe23 (patch)
tree8e9ab2d4ea0595d0875c5fe18579841aed7f3bc7 /Userland/Libraries/LibCore/File.h
parent91bcff29944c98ed1ee69f5d024942175c7a6af2 (diff)
downloadserenity-8cc8d72619e408be8b792499c33b3c9cbc1dbe23.zip
LibCore: Implement preserve flag for file/directory copy
Diffstat (limited to 'Userland/Libraries/LibCore/File.h')
-rw-r--r--Userland/Libraries/LibCore/File.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/Userland/Libraries/LibCore/File.h b/Userland/Libraries/LibCore/File.h
index a8649a20b0..c430d1eade 100644
--- a/Userland/Libraries/LibCore/File.h
+++ b/Userland/Libraries/LibCore/File.h
@@ -53,14 +53,19 @@ public:
No,
};
+ enum class PreserveMode {
+ Nothing,
+ PermissionsOwnershipTimestamps,
+ };
+
struct CopyError {
OSError error_code;
bool tried_recursing;
};
- static Result<void, CopyError> copy_file(String const& dst_path, struct stat const& src_stat, File& source);
- static Result<void, CopyError> copy_directory(String const& dst_path, String const& src_path, struct stat const& src_stat, LinkMode = LinkMode::Disallowed);
- static Result<void, CopyError> copy_file_or_directory(String const& dst_path, String const& src_path, RecursionMode = RecursionMode::Allowed, LinkMode = LinkMode::Disallowed, AddDuplicateFileMarker = AddDuplicateFileMarker::Yes);
+ static Result<void, CopyError> copy_file(String const& dst_path, struct stat const& src_stat, File& source, PreserveMode = PreserveMode::Nothing);
+ static Result<void, CopyError> copy_directory(String const& dst_path, String const& src_path, struct stat const& src_stat, LinkMode = LinkMode::Disallowed, PreserveMode = PreserveMode::Nothing);
+ static Result<void, CopyError> copy_file_or_directory(String const& dst_path, String const& src_path, RecursionMode = RecursionMode::Allowed, LinkMode = LinkMode::Disallowed, AddDuplicateFileMarker = AddDuplicateFileMarker::Yes, PreserveMode = PreserveMode::Nothing);
static String real_path_for(String const& filename);
static String read_link(String const& link_path);