Cheetah Software  1.0
save_file.cpp
Go to the documentation of this file.
2 
3 void cleaning_file(const std::string& folder_name, const std::string& file_name,
4  std::string& full_ret_file) {
5  full_ret_file = THIS_COM + folder_name + file_name;
6  full_ret_file += ".txt";
7 
8  std::list<std::string>::iterator iter = std::find(
9  gs_fileName_string.begin(), gs_fileName_string.end(), full_ret_file);
10  if (gs_fileName_string.end() == iter) {
11  gs_fileName_string.push_back(full_ret_file);
12  remove(full_ret_file.c_str());
13  }
14 }
15 
16 void create_folder(const std::string& folder_name) {
17  std::string full_path = THIS_COM + folder_name;
18 
19  if (mkdir(full_path.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == -1) {
20  if (errno == EEXIST) {
21  // alredy exists
22  // printf("%s is already exist\n", full_path.c_str());
23  } else {
24  // something else
25  std::cout << "cannot create session name folder error:" << strerror(errno)
26  << std::endl;
27  exit(0);
28  }
29  }
30 }
static std::list< std::string > gs_fileName_string
Definition: save_file.h:14
std::string folder_name
Definition: test_spline.cpp:13
void cleaning_file(const std::string &folder_name, const std::string &file_name, std::string &full_ret_file)
Definition: save_file.cpp:3
void create_folder(const std::string &folder_name)
Definition: save_file.cpp:16