BoosterSeat  0.1
A C++ library that includes common utilities that are used in other projects.
filesystem.cpp File Reference

Boost_erSeat's filesystem module. More...

#include "BoosterSeat/filesystem.hpp"
#include "BoosterSeat/exception.hpp"
#include <cstdint>
#include <filesystem>
#include <fstream>
#include <type_traits>
Include dependency graph for filesystem.cpp:

Namespaces

 bst
 
 bst::fs_int
 Internal inline functions used only in this file.
 

Typedefs

typedef bs::ErrorNumber ErrNum
 
typedef std::filesystem::path Path
 
typedef std::filesystem::recursive_directory_iterator RecursiveDirIter
 

Functions

void bst::fs_int::assertDoesNotExist (const Path &path)
 Checks if a path exists, otherwise it will throw an exception. More...
 
void bst::fs_int::assertExists (const Path &path)
 Checks if a path exists, otherwise it will throw an exception. More...
 
template<typename T >
void bst::fs_int::assertFileValid (const Path &path, T &file)
 Checks if the file is open and valid, otherwise it will throw an exception with the error code. This function is only for ifstream and ofstream. Used after opening a file. More...
 
void bst::fs_int::assertIsDirectory (const Path &path)
 Checks if the path exists and is a directory, otherwise it will throw an exception. More...
 
void bst::fs_int::assertIsRegularFile (const Path &path)
 Checks if the path exists and is a regular file, otherwise it will throw an exception. More...
 
void bst::fs_int::assertReadPermissions (const Path &path)
 Only works on Linux at the moment, requires the <unistd.h> header. More...
 
void bst::fs_int::assertWritePermissions (const Path &path)
 Checks a program has write permissions to the file or directory at the path, if not, throws an exception. Only works on Linux at the moment, requires the <unistd.h> header. More...
 
double bst::fs_int::convertMbToUnit (const double size_mb, const fs::units::Size unit)
 
bool bst::fs_int::exists (const Path &path)
 
std::uintmax_t bst::fs_int::get_file_size_bytes (const Path &path)
 
bool bst::fs_int::has_read_permissions (const Path &path)
 Returns true if the program has read permissions. More...
 
bool bst::fs_int::has_write_permission (const Path &path)
 Returns true if the path if the program has write permissions. More...
 
bool bst::fs_int::is_directory (const Path &path)
 Returns true if the path is a directory. More...
 
bool bst::fs_int::is_file (const Path &path)
 Checks if a path is a regular file. More...
 

Detailed Description

Boost_erSeat's filesystem module.

Author
Joshua Jerred (https://joshuajer.red)
Date
2023-12-16

Typedef Documentation

◆ ErrNum

Todo:
change this namespace garbage

◆ Path

typedef std::filesystem::path Path

◆ RecursiveDirIter

typedef std::filesystem::recursive_directory_iterator RecursiveDirIter