118 dirent* entry =
nullptr;
Generic dynamically allocated resizable storage.
Wrapper of type containing either a value or an error message.
Wrapper over enum allowing setting (and querying) individual bits of the stored value.
const EmptyFlags EMPTY_FLAGS
uint32_t Size
Integral type used to index arrays (by default).
#define NAMESPACE_SPH_END
Return value of function that may fail, containing either SUCCEES (true) or error message.
Object representing a path on a filesystem, similar to std::filesystem::path in c++17.
Generic dynamically allocated resizable storage.
Wrapper of type that either contains a value of given type, or an error message.
Object providing begin and end directory iterator for given directory path.
DirectoryIterator begin() const
Returns the directory iterator to the first entry in the directory.
DirectoryIterator end() const
Returns the directory iterator to the one-past-last entry in the directory.
DirectoryAdapter(const Path &directory)
Creates the directory adapter for given path.
Iterator allowing to enumerate files and subdirectories in given directory.
Path operator*() const
Return the path of the file. The path is returned relative to the parent directory.
DirectoryIterator & operator++()
Moves to the next file in the directory.
bool operator==(const DirectoryIterator &other) const
Checks for equality. Returns true in case both iterators are nullptr.
bool operator!=(const DirectoryIterator &other) const
Checks for inequality. Returns false in case both iterators are nullptr.
FileLock(const Path &path)
ScopedWorkingDirectory(const Path &path)
~ScopedWorkingDirectory()
Wrapper of an integral value providing functions for reading and modifying individual bits.
Object representing a path on a filesystem.
static Path currentPath()
Returns the current working directory, or empty path if the function failed.
bool isPathWritable(const Path &path)
Checks whether the given file is writable.
bool pathExists(const Path &path)
Checks if a file or directory exists (or more precisely, if a file or directory is accessible).
bool isFileLocked(const Path &path)
void setWorkingDirectory(const Path &path)
Changes the current working directory.
Outcome removePath(const Path &path, const Flags< RemovePathFlag > flags=EMPTY_FLAGS)
Array< Path > getFilesInDirectory(const Path &directory)
Alternatitve to iterateDirectory, returning all files in directory in an array.
Outcome copyDirectory(const Path &from, const Path &to)
Copies a directory (and all files and subdirectories it contains) to a different path.
@ ALLOW_EXISTING
If the named directory already exists, function returns SUCCESS instead of error message.
Size fileSize(const Path &path)
Returns the size of a file.
Outcome createDirectory(const Path &path, const Flags< CreateDirectoryFlag > flags=CreateDirectoryFlag::ALLOW_EXISTING)
Creates a directory with given path. Creates all parent directories as well.
Outcome copyFile(const Path &from, const Path &to)
Copies a file on given path to a different path.
DirectoryAdapter iterateDirectory(const Path &directory)
Expected< PathType > pathType(const Path &path)
Returns the type of the given path, or error message if the function fails.
std::string readFile(const Path &path)
Reads the whole file into the string.
Expected< Path > getHomeDirectory()
Returns the home directory of the current user.
Path getAbsolutePath(const Path &relativePath)
Returns the absolute path to the file.
Object with deleted copy constructor and copy operator.