Namespaces | Functions
FileSystem.hpp File Reference

Declares functions to do file system manipulations. More...

#include <cstddef>
#include <string>
#include <vector>

Go to the source code of this file.

Namespaces

 file_system
 A light-weight file system library based on POSIX.
 

Functions

std::string file_system::get_parent_path (const std::string &path)
 Wraps the dirname function to get the pathname of the parent directory. More...
 
std::string file_system::get_file_name (const std::string &file_path)
 Given a path to a file returns the file name. More...
 
std::string file_system::get_absolute_path (const std::string &rel_path)
 Get the absolute path, resolving symlinks. More...
 
void file_system::create_directory (const std::string &dir, double wait_time=1, size_t num_tries=40)
 Creates a directory, including any parents that don't exist. If the directory exists create_directory does nothing. More...
 
bool file_system::check_if_dir_exists (const std::string &dir)
 Returns true if the directory exists. More...
 
bool file_system::check_if_file_exists (const std::string &file)
 Returns true if the regular file or link to the regular file exists. More...
 
bool file_system::is_file (const std::string &path)
 Returns true if the path points to a regular file or a link to a regular file. More...
 
size_t file_system::file_size (const std::string &file)
 Returns the file size in bytes. More...
 
std::string file_system::cwd ()
 Returns the current working directory, resolving symlinks.
 
std::vector< std::stringfile_system::ls (const std::string &dir_name="./")
 Gets a list of files in a directory. More...
 
void file_system::rm (const std::string &path, bool recursive)
 Deletes a file or directory. More...
 

Detailed Description

Declares functions to do file system manipulations.