Static Public Member Functions | List of all members
vul_file Struct Reference

A collection of miscellaneous filesystem-type utilities. More...

#include <vul_file.h>

Static Public Member Functions

static std::string get_cwd ()
 Return current working directory. More...
 
static bool change_directory (char const *dirname)
 change current working directory. More...
 
static bool change_directory (std::string const &dirname)
 
static bool make_directory (char const *filename)
 Make a writable directory. More...
 
static bool make_directory (std::string const &filename)
 
static bool make_directory_path (char const *filename)
 Make a writable directory, including any necessary parents. More...
 
static bool make_directory_path (std::string const &filename)
 
static bool is_directory (char const *filename)
 Return true iff filename is a directory. More...
 
static bool is_directory (const std::string &filename)
 
static std::string expand_tilde (char const *filename)
 Expand any leading ~ escapes in filename. More...
 
static std::string expand_tilde (std::string const &filename)
 
static bool exists (char const *filename)
 Return true iff filename exists. It may be any sort of file. More...
 
static bool exists (std::string const &filename)
 
static unsigned long size (char const *filename)
 Return size of vul_file. More...
 
static unsigned long size (std::string filename)
 
static std::string dirname (char const *filename)
 Return dirname. More...
 
static std::string dirname (std::string const &filename)
 
static std::string extension (char const *filename)
 Return extension (including the '. More...
 
static std::string extension (std::string const &filename)
 
static std::string basename (char const *filename, char const *suffix=nullptr)
 Return basename. More...
 
static std::string basename (std::string const &filename, char const *suffix=nullptr)
 
static std::string strip_directory (char const *filename)
 Strips away directory of the filename. More...
 
static std::string strip_directory (std::string const &filename)
 
static std::string strip_extension (char const *filename)
 Strips away extension of the filename. More...
 
static std::string strip_extension (std::string const &filename)
 
static bool delete_file_glob (std::string const &file_glob)
 Delete 1 or more files using the Local OS preferred globbing. More...
 
static bool delete_file_glob (char const *file_glob)
 
static std::time_t time_modified (char const *filename)
 
static std::time_t time_modified (std::string const &filename)
 

Detailed Description

A collection of miscellaneous filesystem-type utilities.

Definition at line 26 of file vul_file.h.

Member Function Documentation

◆ basename() [1/2]

std::string vul_file::basename ( char const *  filename,
char const *  suffix = nullptr 
)
static

Return basename.

Only strip specified suffix.

Definition at line 177 of file vul_file.cxx.

◆ basename() [2/2]

static std::string vul_file::basename ( std::string const &  filename,
char const *  suffix = nullptr 
)
inlinestatic

Definition at line 97 of file vul_file.h.

◆ change_directory() [1/2]

bool vul_file::change_directory ( char const *  dirname)
static

change current working directory.

Definition at line 41 of file vul_file.cxx.

◆ change_directory() [2/2]

static bool vul_file::change_directory ( std::string const &  dirname)
inlinestatic

Definition at line 33 of file vul_file.h.

◆ delete_file_glob() [1/2]

bool vul_file::delete_file_glob ( std::string const &  file_glob)
static

Delete 1 or more files using the Local OS preferred globbing.

E.g. delete_file_glob("*"); will delete all the files in the current directory on most operating systems.

Returns
true if successful.

E.g. delete_file_glob("*"); will delete all the files in the current directory on most operating systems. Takes Posix path separators i.e. '/'

Definition at line 221 of file vul_file.cxx.

◆ delete_file_glob() [2/2]

static bool vul_file::delete_file_glob ( char const *  file_glob)
inlinestatic

Definition at line 116 of file vul_file.h.

◆ dirname() [1/2]

std::string vul_file::dirname ( char const *  filename)
static

Return dirname.

Definition at line 124 of file vul_file.cxx.

◆ dirname() [2/2]

static std::string vul_file::dirname ( std::string const &  filename)
inlinestatic

Definition at line 84 of file vul_file.h.

◆ exists() [1/2]

bool vul_file::exists ( char const *  filename)
static

Return true iff filename exists. It may be any sort of file.

Definition at line 108 of file vul_file.cxx.

◆ exists() [2/2]

static bool vul_file::exists ( std::string const &  filename)
inlinestatic

Definition at line 74 of file vul_file.h.

◆ expand_tilde() [1/2]

std::string vul_file::expand_tilde ( char const *  filename)
static

Expand any leading ~ escapes in filename.

Definition at line 234 of file vul_file.cxx.

◆ expand_tilde() [2/2]

static std::string vul_file::expand_tilde ( std::string const &  filename)
inlinestatic

Definition at line 68 of file vul_file.h.

◆ extension() [1/2]

std::string vul_file::extension ( char const *  filename)
static

Return extension (including the '.

').

Definition at line 140 of file vul_file.cxx.

◆ extension() [2/2]

static std::string vul_file::extension ( std::string const &  filename)
inlinestatic

Definition at line 90 of file vul_file.h.

◆ get_cwd()

std::string vul_file::get_cwd ( )
static

Return current working directory.

Definition at line 31 of file vul_file.cxx.

◆ is_directory() [1/2]

bool vul_file::is_directory ( char const *  filename)
static

Return true iff filename is a directory.

Definition at line 55 of file vul_file.cxx.

◆ is_directory() [2/2]

static bool vul_file::is_directory ( const std::string &  filename)
inlinestatic

Definition at line 54 of file vul_file.h.

◆ make_directory() [1/2]

bool vul_file::make_directory ( char const *  filename)
static

Make a writable directory.

You might imagine mkdir would be a better name, and then you might imagine a world w/out ms.

Definition at line 46 of file vul_file.cxx.

◆ make_directory() [2/2]

static bool vul_file::make_directory ( std::string const &  filename)
inlinestatic

Definition at line 41 of file vul_file.h.

◆ make_directory_path() [1/2]

bool vul_file::make_directory_path ( char const *  filename)
static

Make a writable directory, including any necessary parents.

Returns true if successful, or if the directory already exists.

Returns true if successful, or if the directory already exists. Implemented by calling itself recursively on the parent directory.

Definition at line 83 of file vul_file.cxx.

◆ make_directory_path() [2/2]

static bool vul_file::make_directory_path ( std::string const &  filename)
inlinestatic

Definition at line 48 of file vul_file.h.

◆ size() [1/2]

unsigned long vul_file::size ( char const *  filename)
static

Return size of vul_file.

Definition at line 99 of file vul_file.cxx.

◆ size() [2/2]

static unsigned long vul_file::size ( std::string  filename)
inlinestatic

Definition at line 80 of file vul_file.h.

◆ strip_directory() [1/2]

std::string vul_file::strip_directory ( char const *  filename)
static

Strips away directory of the filename.

Definition at line 151 of file vul_file.cxx.

◆ strip_directory() [2/2]

static std::string vul_file::strip_directory ( std::string const &  filename)
inlinestatic

Definition at line 103 of file vul_file.h.

◆ strip_extension() [1/2]

std::string vul_file::strip_extension ( char const *  filename)
static

Strips away extension of the filename.

Definition at line 166 of file vul_file.cxx.

◆ strip_extension() [2/2]

static std::string vul_file::strip_extension ( std::string const &  filename)
inlinestatic

Definition at line 108 of file vul_file.h.

◆ time_modified() [1/2]

std::time_t vul_file::time_modified ( char const *  filename)
static

Definition at line 62 of file vul_file.cxx.

◆ time_modified() [2/2]

static std::time_t vul_file::time_modified ( std::string const &  filename)
inlinestatic

Definition at line 214 of file vul_file.h.


The documentation for this struct was generated from the following files: