![]() |
libfilezilla
|
This class can be used to enumerate the contents of local directories and to query the metadata of files. More...
#include <local_filesys.hpp>
Public Types | |
enum | type { unknown = -1, file, dir, link } |
Types of files. While 'everything is a file', a filename can refer to a file proper, a directory or a symbolic link. | |
Public Member Functions | |
local_filesys (local_filesys const &)=delete | |
local_filesys & | operator= (local_filesys const &)=delete |
bool | begin_find_files (native_string path, bool dirs_only=false) |
Begins enumerating a directory. More... | |
bool | get_next_file (native_string &name) |
Gets the next file in the directory. Call until it returns false. | |
bool | get_next_file (native_string &name, bool &is_link, bool &is_dir, int64_t *size, datetime *modification_time, int *mode) |
void | end_find_files () |
Ends enumerating files. Automatically called in the destructor. | |
Static Public Member Functions | |
static bool | is_separator (wchar_t c) |
Checks whether given character is a path separator. More... | |
static type | get_file_type (native_string const &path, bool follow_links=false) |
GetFileType return the type of the passed path. More... | |
static type | get_file_info (native_string const &path, bool &is_link, int64_t *size, datetime *modification_time, int *mode) |
static int64_t | get_size (native_string const &path, bool *is_link=nullptr) |
Gets size of file, returns -1 on error. | |
static datetime | get_modification_time (native_string const &path) |
static bool | set_modification_time (native_string const &path, const datetime &t) |
static native_string | get_link_target (native_string const &path) |
Get the target path of a symbolic link. | |
Static Public Attributes | |
static char const | path_separator |
The system's preferred path separator. | |
This class can be used to enumerate the contents of local directories and to query the metadata of files.
This class is aware of symbolic links. Under Windows it can handle reparse points as well.
bool begin_find_files | ( | native_string | path, |
bool | dirs_only = false |
||
) |
Begins enumerating a directory.
dirs_only | If true, only directories are enumerated. |
|
static |
Gets the info for the passed arguments. Follows symbolic links and stats the target, sets is_link to true if path was a link.
|
static |
GetFileType return the type of the passed path.
Can optionally follow symbolic links.
bool get_next_file | ( | native_string & | name, |
bool & | is_link, | ||
bool & | is_dir, | ||
int64_t * | size, | ||
datetime * | modification_time, | ||
int * | mode | ||
) |
Gets the next file in the directory. Call until it returns false.
Stores the metadata in any non-null arguments.
|
inlinestatic |
Checks whether given character is a path separator.
On most systems, the forward slash is the only separator. The exception is Windows where both forward and backward slashes are separators, with the latter being preferred.