|
crawlserv++
[under development]
Application for crawling and analyzing textual content of websites.
|
Namespace for global file system helper functions. More...
Classes | |
| class | Exception |
| Class for file system exceptions. More... | |
Existence and Validity | |
| bool | exists (std::string_view path) |
| Checks whether the specified path exists. More... | |
| bool | isValidDirectory (std::string_view path) |
| Checks whether the given path points to a valid directory. More... | |
| bool | isValidFile (std::string_view path) |
| Checks whether the given path points to a valid file. More... | |
Paths and Directories | |
| char | getPathSeparator () |
| Gets the preferred separator for file paths in the current operating system. More... | |
| std::vector< std::string > | listFilesInPath (std::string_view pathToDir, std::string_view fileExtension) |
| Lists all files with the given extension in the given directory and its subdirectories. More... | |
| bool | contains (std::string_view pathToDir, std::string_view pathToCheck) |
| Checks whether the given path is located inside the given directory. More... | |
| void | createDirectory (std::string_view pathToDir) |
| Creates a directory at the given path. More... | |
| void | createDirectoryIfNotExists (std::string_view pathToDir) |
| Creates a directory at the given path, if it does not exist already. More... | |
| void | clearDirectory (std::string_view pathToDir) |
| Deletes all files and folders in the given directory. More... | |
Disk Space | |
| std::uintmax_t | getFreeSpace (std::string_view path) |
| Gets the available disk space at the given location in bytes. More... | |
Namespace for global file system helper functions.
|
inline |
Deletes all files and folders in the given directory.
| pathToDir | A string view containing a path to the directory which contents should be deleted. |
| FileSystem::Exception | if the given path does not point to a valid directory or one of its contents could not be removed. |
References isValidDirectory().
Referenced by crawlservpp::Main::Server::tick().
|
inline |
Checks whether the given path is located inside the given directory.
| pathToDir | A string view containing the directory in which the given path should be located. |
| pathToCheck | A string view containing the path which should be located inside the directory. |
| FileSystem::Exception | if the given directory does not exist, or the path to check contains an unsupported symlink. |
References isValidDirectory().
Referenced by crawlservpp::Main::WebServer::sendFile(), crawlservpp::Network::Curl::setConfigGlobal(), and crawlservpp::Main::Server::tick().
|
inline |
Creates a directory at the given path.
| pathToDir | A string view containing the path to the directory to be created. |
| FileSystem::Exception | if the directory could not be created. |
Referenced by createDirectoryIfNotExists(), and crawlservpp::Main::Server::tick().
|
inline |
Creates a directory at the given path, if it does not exist already.
| pathToDir | A string view containing the path to the directory to be created, if it does not exist already |
| FileSystem::Exception | if the directory does not exist, but could not be created. |
References createDirectory(), and isValidDirectory().
Referenced by crawlservpp::Main::Server::tick().
|
inline |
Checks whether the specified path exists.
| path | A string view containing the path to be checked for existence. |
| FileSystem::Exception | if the existence of the path could not be checked. |
Referenced by crawlservpp::Main::WebServer::getIP(), isValidDirectory(), isValidFile(), and listFilesInPath().
|
inline |
Gets the available disk space at the given location in bytes.
| path | A string view containing a path to the directory for which the available disk space should be determined. |
| FileSystem::Exception | if the available disk space could not be dettermined at the given location. |
|
inline |
Gets the preferred separator for file paths in the current operating system.
Referenced by crawlservpp::Data::TokenRemover::clear(), crawlservpp::Data::Lemmatizer::clear(), crawlservpp::Main::Database::connect(), crawlservpp::Main::WebServer::getIP(), crawlservpp::Helper::Versions::getTomotoVersion(), crawlservpp::Module::Analyzer::Algo::SentimentOverTime::onAlgoInit(), crawlservpp::Module::Analyzer::Algo::TopicModelling::resetAlgo(), crawlservpp::Main::WebServer::sendFile(), crawlservpp::Network::Curl::setConfigGlobal(), crawlservpp::Module::Database::setLogging(), and crawlservpp::Main::Server::tick().
|
inline |
Checks whether the given path points to a valid directory.
| path | A string view containing the path to check. |
| FileSystem::Exception | if the validity of the directory could not be checked. |
References exists().
Referenced by crawlservpp::Main::Database::addWebsite(), clearDirectory(), contains(), createDirectoryIfNotExists(), and crawlservpp::Main::Server::tick().
|
inline |
Checks whether the given path points to a valid file.
| path | A string view containing the path to check. |
| FileSystem::Exception | if the validity of the file could not be checked. |
References exists().
Referenced by crawlservpp::Main::Server::tick().
|
inline |
Lists all files with the given extension in the given directory and its subdirectories.
pathToDir) needs to exist, the given path to check (pathToCheck) does not. | pathToDir | A string view containing the directory to search for files. |
| fileExtension | A string view containing the extension of the files to search for. If empty, all files will be returned. |
| FileSystem::Exception | if the given path is invalid or does not exist, or when the iteration over all the contents of the directory has failed. |
References exists().
Referenced by crawlservpp::Main::Database::initializeSql(), and crawlservpp::Main::Server::tick().