Namespace containing FileSystem I/O commands.
More...
|
std::vector< char > | LoadFile (const std::filesystem::path &file) |
|
bool | WriteFile (const std::filesystem::path &file, const std::vector< char > &data) |
|
std::filesystem::path | FindExecutableInPath (const std::string &executable) |
|
std::string | ExecuteSync (const std::string &cmd) |
|
std::future< void > | ExecuteAsync (const std::string &cmd, std::ostream &ostr=std::cout) |
|
Namespace containing FileSystem I/O commands.
◆ ExecuteAsync()
std::future<void> giri::FileSystem::ExecuteAsync |
( |
const std::string & |
cmd, |
|
|
std::ostream & |
ostr = std::cout |
|
) |
| |
|
inline |
Executes a command asynchronously.
- Parameters
-
cmd | Command to execute. |
ostr | Stream to write command output to. (defaults to std::cout) |
- Returns
- Future object which can be used for synchronization.
◆ ExecuteSync()
std::string giri::FileSystem::ExecuteSync |
( |
const std::string & |
cmd | ) |
|
|
inline |
Executes a command synchronously.
- Parameters
-
- Returns
- The output of the command after finishing execution.
◆ FindExecutableInPath()
std::filesystem::path giri::FileSystem::FindExecutableInPath |
( |
const std::string & |
executable | ) |
|
|
inline |
Searches for an executable within PATH.
- Parameters
-
executable | Name of executable to search for. |
- Returns
- Path to executable if existent, emtpty string if not existent.
◆ LoadFile()
std::vector<char> giri::FileSystem::LoadFile |
( |
const std::filesystem::path & |
file | ) |
|
|
inline |
Loads blob data from the harddisk. Throws FileSystemException on error.
- Parameters
-
file | Filepath to load data from. |
◆ WriteFile()
bool giri::FileSystem::WriteFile |
( |
const std::filesystem::path & |
file, |
|
|
const std::vector< char > & |
data |
|
) |
| |
|
inline |
Writes data to the harddisk. If given file does not exist it will be created. If file does already exist it will be overridden.
- Parameters
-
file | Filepath to write data to. |
data | Data to write. |
- Returns
- true on success, false on failure.