CBMC
file_util.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module:
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
9 
10 #ifndef CPROVER_UTIL_FILE_UTIL_H
11 #define CPROVER_UTIL_FILE_UTIL_H
12 
13 #include <string>
14 
15 // C++17 will allow us to use std::filesystem::path::remove_all
16 void delete_directory(const std::string &path);
17 
18 // C++17 will allow us to use std::filesystem::current_path (for both get and
19 // set)
20 std::string get_current_working_directory();
21 void set_current_path(const std::string &path);
22 
23 // C++17 will allow us to use std::filesystem::path(dir).append(file)
24 std::string concat_dir_file(const std::string &directory,
25  const std::string &file_name);
26 
27 // C++17 will allow us to use std::filesystem::is_directory
28 bool is_directory(const std::string &path);
29 
33 bool create_directory(const std::string &path);
34 
38 bool file_exists(const std::string &path);
39 
40 // Delete a file with given path
43 bool file_remove(const std::string &path);
44 
48 void file_rename(const std::string &old_path, const std::string &new_path);
49 
50 #endif // CPROVER_UTIL_FILE_UTIL_H
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.
Definition: file_util.cpp:212
file_exists
bool file_exists(const std::string &path)
Check whether file with given path exists.
Definition: file_util.cpp:222
delete_directory
void delete_directory(const std::string &path)
deletes all files in 'path' and then the directory itself
Definition: file_util.cpp:118
file_rename
void file_rename(const std::string &old_path, const std::string &new_path)
Rename a file.
Definition: file_util.cpp:240
file_remove
bool file_remove(const std::string &path)
C++17 will allow us to use std::filesystem::remove.
Definition: file_util.cpp:231
get_current_working_directory
std::string get_current_working_directory()
Definition: file_util.cpp:51
set_current_path
void set_current_path(const std::string &path)
Set working directory.
Definition: file_util.cpp:82
is_directory
bool is_directory(const std::string &path)
Definition: file_util.cpp:187
concat_dir_file
std::string concat_dir_file(const std::string &directory, const std::string &file_name)
Definition: file_util.cpp:159