1#ifndef LIBFILEZILLA_LOCAL_FILESYS_HEADER
2#define LIBFILEZILLA_LOCAL_FILESYS_HEADER
10#include "glue/windows.hpp"
26class FZ_PUBLIC_SYMBOL local_filesys final
29 local_filesys() =
default;
32 local_filesys(local_filesys
const&) =
delete;
33 local_filesys& operator=(local_filesys
const&) =
delete;
35 local_filesys(local_filesys &&)
noexcept;
36 local_filesys& operator=(local_filesys &&)
noexcept;
54 return c ==
'/' || c ==
'\\';
163 bool FZ_PRIVATE_SYMBOL check_buffer();
164 std::vector<unsigned char> buffer_;
165 unsigned char* cur_{};
166 HANDLE dir_{INVALID_HANDLE_VALUE};
173 bool query_symlink_targets_{
true};
229 return (
static_cast<unsigned int>(lhs) &
static_cast<unsigned int>(rhs)) != 0;
233 return static_cast<rename_flags>(
static_cast<unsigned int>(lhs) |
static_cast<unsigned int>(rhs));
Represents a point of time in wallclock, tracking the timestamps accuracy/precision.
Definition time.hpp:41
static type get_file_info(native_string const &path, bool &is_link, int64_t *size, datetime *modification_time, int *mode, bool follow_links=true)
Gets the info for the passed arguments.
static type get_file_type(native_string const &path, bool follow_links=false)
get_file_type return the type of the passed path.
bool get_next_file(native_string &name, bool &is_link, type &t, int64_t *size, datetime *modification_time, int *mode)
Gets the next file in the directory. Call until it returns false.
static int64_t get_size(native_string const &path, bool *is_link=nullptr)
Gets size of file, returns -1 on error.
static result set_modification_time(file::file_t fd, datetime const &t)
Sets the modification time of an open file or directory.
static native_string get_final_link_target(native_string const &path)
Get the final target path of a symbolic link (chain).
void end_find_files()
Ends enumerating files. Automatically called in the destructor.
static char const path_separator
The system's preferred path separator.
Definition local_filesys.hpp:47
file::file_t fd()
Returns the raw descriptor/handle, but retains ownership.
result begin_find_files(file::file_t fd, bool dirs_only=false, bool query_symlink_targets=true)
Begin enumerating a directory represented by a descriptor.
type
Types of files. While 'everything is a file', a filename can refer to a file proper,...
Definition local_filesys.hpp:39
static result get_modification_time(file::file_t fd, datetime &t)
Gets the modification time of an open file or directory.
static bool is_separator(wchar_t c)
Checks whether given character is a path separator.
Definition local_filesys.hpp:52
static native_string get_link_target(native_string const &path)
Get the immediate target path of a symbolic link. Only consideres the immediate link....
result begin_find_files(native_string path, bool dirs_only=false, bool query_symlink_targets=true)
Begins enumerating a directory.
static result get_file_info(native_string const &path, bool &is_link, type &type, int64_t *size, datetime *modification_time, int *mode, bool follow_links=true)
Gets the info for the passed arguments.
bool get_next_file(native_string &name)
Gets the next file in the directory. Call until it returns false.
Small class to return filesystem errors.
Definition fsresult.hpp:26
result and rwresult wrappers for dealing with file system errors.
Sets some global macros and further includes string.hpp.
The namespace used by libfilezilla.
Definition apply.hpp:17
mkdir_permissions
Definition local_filesys.hpp:177
@ cur_user_and_admins
Only current user and administrators.
Definition local_filesys.hpp:186
@ cur_user
Only current user.
Definition local_filesys.hpp:183
@ normal
Definition local_filesys.hpp:180
result mkdir(native_string const &absolute_path, bool recurse, mkdir_permissions permissions=mkdir_permissions::normal, native_string *last_created=nullptr)
Creates directory if it doesn't yet exist.
std::wstring native_string
A string in the system's native character type and encoding. Note: This typedef changes depending on...
Definition string.hpp:69
result remove_dir(native_string const &absolute_path, bool missing_dir_is_error)
Removes empty directory.
result rename_file(native_string const &source, native_string const &dest, rename_flags flags)
Rename/move the passed file or directory.
rename_flags
Options for rename_file, combinable with operator|.
Definition local_filesys.hpp:217
@ allow_copy
Allow files, but not directories, to be copied across filesystems before deleting the source.
Definition local_filesys.hpp:222
@ no_replace
Reject an existing destination with result::preexisting; see rename_file for atomicity limitations.
Definition local_filesys.hpp:225
Assorted classes dealing with time.