00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef FILES_TOOLS_H
00022 #define FILES_TOOLS_H
00023
00024 #include <string>
00025 #include <iostream>
00026 #include <cstdio>
00027 #include <sys/types.h>
00028 #include <dirent.h>
00029 using namespace std;
00030
00031 class bad_tmp_dir {
00032 public:
00033 bad_tmp_dir() {};
00034 ~bad_tmp_dir() {};
00035 void what() const {
00036 cout <<"bad_tmp_dir : can't find the temporary directory. Review the get_temp_dir function in file_tools.cpp"<<endl;
00037 };
00038 };
00039
00051 bool file_can_be_opened_as(const string & path_and_filename = "", const string &mode = "r");
00052
00058 bool exists_file(const string &path_and_filename = "");
00064 bool exists_dir(const string &dir_path);
00071 const string get_directory(const string &path_and_filename = "");
00078 const string get_tail(const string &filename = "");
00085 const string basename(const string &filename = "");
00092 const string get_tmp_dir();
00093 #endif
00094
00095