KrisLibrary
1.0.0
|
Cross-platform wrapper for file utilities. More...
#include <stdlib.h>
#include <string>
#include <vector>
Go to the source code of this file.
Functions | |
void | FileUtils::SafeFileName (char *str) |
std::string | FileUtils::SafeFileName (const std::string &str) |
bool | FileUtils::Exists (const char *fn) |
Returns true if the file fn exists. | |
bool | FileUtils::Delete (const char *fn) |
Deletes the file. Returns true if successful. | |
bool | FileUtils::Rename (const char *from, const char *to) |
Renames the file. Returns true if successful. | |
bool | FileUtils::Copy (const char *from, const char *to) |
Copies the file. Returns true if successful. | |
bool | FileUtils::TempName (char *out, const char *directory, const char *prefix) |
bool | FileUtils::IsDirectory (const char *path) |
Returns true if the file is a directory. | |
bool | FileUtils::MakeDirectory (const char *path) |
Creates the directory, if it doesn't exist. Returns true if successful. | |
bool | FileUtils::MakeDirectoryRecursive (const char *path) |
bool | FileUtils::ListDirectory (const char *path, std::vector< std::string > &items) |
Returns a list of filenames in the given directory. | |
std::string | FileUtils::GetWorkingDirectory () |
Returns the current working directory. | |
Cross-platform wrapper for file utilities.
File names are given as unix-formatted strings (directories separated by a forward slash '/').
bool FileUtils::MakeDirectoryRecursive | ( | const char * | path | ) |
Creates all subdirectories leading up to the directory, if they don't exist. Returns true if successful.
bool FileUtils::TempName | ( | char * | out, |
const char * | directory = NULL , |
||
const char * | prefix = NULL |
||
) |
Returns the name of a temporary file in out. Optionally takes a directory and prefix for the file name. Returns true if successful.