BoosterSeat  0.1
A C++ library that includes common utilities that are used in other projects.
filesystem.hpp File Reference
#include <stdint.h>
#include <string>
Include dependency graph for filesystem.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 bst
 
 bst::filesystem
 
 bst::filesystem::units
 

Enumerations

enum class  bst::filesystem::units::Size {
  bst::filesystem::units::BITS , bst::filesystem::units::BYTES , bst::filesystem::units::KILOBYTES , bst::filesystem::units::MEGABYTES ,
  bst::filesystem::units::GIGABYTES , bst::filesystem::units::TERABYTES
}
 
enum class  bst::filesystem::units::Type { bst::filesystem::units::FILE , bst::filesystem::units::DIRECTORY }
 

Functions

void bst::filesystem::appendToFile (const std::string &file_path, const std::string &content, const bool new_line_after=true)
 Append a string to a file. More...
 
void bst::filesystem::copyFile (const std::string &source_path, const std::string &destination_path, bool overwrite=false)
 Move a file from one location to another. More...
 
void bst::filesystem::createDirectory (const std::string &directory_path)
 Create a Directory at the specified path. More...
 
void bst::filesystem::createFile (const std::string &file_path)
 Create a File. More...
 
void bst::filesystem::deleteFile (const std::string &file_path)
 Delete a file. More...
 
bool bst::filesystem::doesDirectoryExist (const std::string &directory_path)
 Returns a boolean indicating whether or not the directory exists. More...
 
bool bst::filesystem::doesFileExist (const std::string &file_path)
 Returns a boolean indicating whether or not the file exists. If it's a directory an exception will be thrown. More...
 
double bst::filesystem::getDirectorySize (const std::string &directory_path, units::Size unit=units::Size::BYTES)
 Get the size of a directory. Only includes regular files. More...
 
std::string bst::filesystem::getFileName (const std::string &file_path)
 Get the File Name from a path. Does not need to exist. More...
 
double bst::filesystem::getFileSize (const std::string &file_path, units::Size size_unit=units::Size::BYTES)
 Get the size of a file. More...
 
uintmax_t bst::filesystem::getFileSizeBytes (const std::string &file_path)
 Get the size of a file. More...
 
bool bst::filesystem::hasReadPermission (const std::string &path)
 If a program has read permissions to a file or directory, it will return true. Otherwise, it will return false. More...
 
bool bst::filesystem::hasWritePermission (const std::string &path)
 If a program has write permissions to a file or directory, it will return true. Otherwise, it will return false. More...
 
void bst::filesystem::moveFile (const std::string &source_path, const std::string &destination_path, bool overwrite=false)
 Move a file from one location to another. More...
 
void bst::filesystem::overwriteFile (const std::string &file_path, const std::string &content)
 Overwrite a files with a string. More...