Base Framework
|
#include <base/filesystem/FileSystem.h>
Inherits Object.
Classes | |
class | Quota |
Public Types | |
enum | { BLOCK = 1, CHARACTER = 2, DEVICE = 1024, FIFO = 4, FOLDER = 8, LINK = 16, MESSAGE_QUEUE = 32, REGULAR = 64, SOCKET = 128, SEMPAHORE = 256, SHARED_MEMORY = 512 } |
enum | TemporaryFolder { USER_SPECIFIED, MACHINE_NONPERSISTENT, MACHINE_PERSISTENT } |
enum | TemporaryFileNameField { PREFIX = 1, USER = 2, APPLICATION = 4, PROCESS = 8, HOST = 16, COUNTER = 32, TIME = 64, RANDOM = 128, SUFFIX = 256 } |
enum | TemporaryFileOption { STRICT_ACCESS = 1, OVERWRITE_ON_CLOSE = 2, REMOVE_ON_CLOSE = 4, EXCLUSIVE = 8, SECURE = STRICT_ACCESS | OVERWRITE_ON_CLOSE | REMOVE_ON_CLOSE } |
enum | Component { FOLDER_PATH, FILENAME, NAME, DOTEXTENSION, EXTENSION } |
enum | Variable { MIN_FILE_SIZE_BITS, MAX_NUM_OF_LINKS, MAX_LEN_OF_NAME, MAX_LEN_OF_PATH, MAX_SIZE_OF_PIPE_BUFFER, MAX_SIZE_OF_SYMLINK } |
enum | Folder { ROOT, DEVICES, TEMP } |
Static Public Member Functions | |
static bool | isSeparator (ucs4 ch) noexcept |
static MemoryDiff | findSeparator (const String &path, MemorySize start) |
static MemoryDiff | findLastSeparator (const String &path) |
static String | getPath (const String &base, const String &relative) noexcept |
static String | join (const String &base, const String &relative) noexcept |
static String | join (const std::initializer_list< String > &paths) noexcept |
static String | getComponent (const String &path, Component component) |
static bool | isAbsolutePath (const String &path) noexcept |
static bool | isFolderPath (const String &path) noexcept |
static String | toAbsolutePath (const String &base, const String &path) |
static String | findFile (const Array< String > &searchPaths, const String &relative, unsigned int index=0) |
static String | toUrl (const String &path) |
static String | getCurrentFolder () |
static void | setCurrentFolder (const String &path) |
static unsigned int | getType (const String &path) |
static uint64 | getSize (const String &path) |
static bool | entryExists (const String &path) |
static bool | fileExists (const String &path) |
static bool | folderExists (const String &path) |
static void | removeFile (const String &path) |
static void | removeFolder (const String &path) |
static void | makeFolder (const String &path) |
static void | makeFolderRecursive (const String &path) |
static bool | doesSupportLinks () noexcept |
static void | makeHardLink (const String &target, const String &destination) |
static bool | isLink (const String &path) |
static void | makeLink (const String &target, const String &destination) |
static String | getLinkTarget (const String &path) |
static String | getTempFolder (TemporaryFolder folder=USER_SPECIFIED) noexcept |
static String | getTempFileName (unsigned int fields=PREFIX|APPLICATION|USER|SUFFIX) noexcept |
static File | getTempFile (unsigned int options=SECURE) |
static unsigned long | getVariable (const String &path, Variable variable) |
static String | getFolder (Folder folder) noexcept |
static String | getRelativePath (const String &folder, const String &path) |
static String | getParent (const String &path) |
static Array< String > | split (const String &path) |
static String | join (const Array< String > &paths) |
static String | normalize (const String &path) |
static Quota | getQuota (const String &path, Trustee trustee) |
Static Public Attributes | |
static const unsigned int | MAXIMUM_PATH_LENGTH |
anonymous enum |
enum FileSystem::Folder |
The fields of a temporary file.
Enumerator | |
---|---|
PREFIX | Add the prefix '~'. |
USER | Add the user name. |
APPLICATION | Add the formal name of application. |
PROCESS | Add the process id. |
HOST | Add the host name. |
COUNTER | Add internal counter (and increment the counter). |
TIME | Add the current time. |
RANDOM | Add a random number. |
SUFFIX | Add the suffix '.tmp'. |
Temporary file options.
The temporary folder.
enum FileSystem::Variable |
File system variables.
|
staticnoexcept |
Returns true if symbolic links are supported. This method always returns true for Unices.
|
static |
Returns true if the entry exists.
|
static |
Returns true if the file exists.
|
static |
Returns the absolute path of the first file found.
searchPaths | The search paths. |
relative | The relative path (SHOULD not be absolute). |
index | Specifies the first index in the searchPaths. The default is 0. |
|
static |
Returns the index of the last separator. For Windows both \ and / are separator.
Returns -1 is not found.
|
static |
Returns the index of the first separator. For Windows both \ and / are separator.
Returns -1 is not found.
|
static |
Returns true if the folder exists.
Returns the specified component of the path.
path | The path. |
component | The desired component (FOLDER_PATH, NAME, EXTENSION, ...). |
|
static |
Returns the path of the current folder.
Returns the path to the specified folder.
Returns the target of the symbolic link.
path | The path of the symbolic link. |
Returns the combined path of the specified base and relative path.
base | The base path. |
relative | The relative path. |
Returns the quota.
path | The path to the device. |
trustee | The truestee. |
Returns the relative path to the given folder.
getRelativePath("a/b/c/d/e/f", "a/b/c/g/h/i") returns "../../../g/h/i".
|
static |
Returns the size of the specified file.
Returns a temporary file.
options | The file options. The default is SECURE. |
|
staticnoexcept |
Generates a temporary file name. The returned name should be used in conjuction with a folder path returned by getTempFolder or other folder path. Every field is separated by a '-' except for the PREFIX and SUFFIX. The order of the fields are fixed and given by the order of the fields within the enumeration TemporaryFileNameField.
fields | Specifies the fields to include in the name. The default is PREFIX|APPLICATION|USER|SUFFIX. |
|
staticnoexcept |
Returns the path to the folder intended for temporary files.
folder | Specifies the folder to be used. The default is USER_SPECIFIED. |
|
static |
Returns the file system flags describing the specified entry.
Returns the value of the specified file system variable.
|
staticnoexcept |
Returns true if the specifies path is an absolute path.
|
inlinestaticnoexcept |
Returns true if the specified path is a explicit folder path (i.e. ends with the separator).
|
static |
Returns true if the file object specified by the path is a symbolic link.
|
inlinestaticnoexcept |
Returns true if char is a separator. For Windows both \ and / are separator.
Returns the combined path of the specified base and relative path.
paths | The paths to join. |
|
inlinestaticnoexcept |
Returns the combined path of the specified base and relative path.
base | The base path. |
relative | The relative path. |
|
static |
Makes a folder.
|
static |
Makes a folder.
Creates a hard link.
target | The target of the link. |
destination | The path of the destination file/folder. |
Creates a symbolic link.
target | The target of the link. |
destination | The path of the destination file/folder. |
|
static |
Removes the specified file.
|
static |
Removes the specified folder. The folder must be empty.
|
static |
Sets the current folder.
Returns the path split into sections.
Separators are not included in result except the first item it is is to indicate root.
Converts the path to an absolute path.
base | The base path. |
path | The path to be converted. |
Returns a URL from the specified path. The URL has the following format: "file:///C:/WINNT" or "file:///usr/local".
path | The path to convert to a URL (MUST be absolute). |
|
static |
Specifies the maximum length of a path.