CBMC
file_util.h File Reference
#include <string>
+ Include dependency graph for file_util.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void delete_directory (const std::string &path)
 deletes all files in 'path' and then the directory itself More...
 
std::string get_current_working_directory ()
 
void set_current_path (const std::string &path)
 Set working directory. More...
 
std::string concat_dir_file (const std::string &directory, const std::string &file_name)
 
bool is_directory (const std::string &path)
 
bool create_directory (const std::string &path)
 Create a directory with given path C++17 will allow us to use std::filesystem::create_directory. More...
 
bool file_exists (const std::string &path)
 Check whether file with given path exists. More...
 
bool file_remove (const std::string &path)
 C++17 will allow us to use std::filesystem::remove. More...
 
void file_rename (const std::string &old_path, const std::string &new_path)
 Rename a file. More...
 

Function Documentation

◆ concat_dir_file()

std::string concat_dir_file ( const std::string &  directory,
const std::string &  file_name 
)
parameters: directory name and file name
Returns
concatenation of directory and file, if the file path is relative

Definition at line 159 of file file_util.cpp.

◆ create_directory()

bool create_directory ( const std::string &  path)

Create a directory with given path C++17 will allow us to use std::filesystem::create_directory.

Returns
true iff the directory was created

Definition at line 212 of file file_util.cpp.

◆ delete_directory()

void delete_directory ( const std::string &  path)

deletes all files in 'path' and then the directory itself

Definition at line 118 of file file_util.cpp.

◆ file_exists()

bool file_exists ( const std::string &  path)

Check whether file with given path exists.

C++17 will allow us to use std::filesystem::directory_entry(file).exists()

Returns
true iff the file exists

Definition at line 222 of file file_util.cpp.

◆ file_remove()

bool file_remove ( const std::string &  path)

C++17 will allow us to use std::filesystem::remove.

Returns
true if the file was deleted, false if it did not exist

Definition at line 231 of file file_util.cpp.

◆ file_rename()

void file_rename ( const std::string &  old_path,
const std::string &  new_path 
)

Rename a file.

C++17 will allow us to use std::filesystem::rename Throws an exception on failure.

Definition at line 240 of file file_util.cpp.

◆ get_current_working_directory()

std::string get_current_working_directory ( )
Returns
current working directory

Definition at line 51 of file file_util.cpp.

◆ is_directory()

bool is_directory ( const std::string &  path)

Definition at line 187 of file file_util.cpp.

◆ set_current_path()

void set_current_path ( const std::string &  path)

Set working directory.

Parameters
pathNew working directory to change to

Definition at line 82 of file file_util.cpp.