8 #ifndef ILANG_UTIL_FS_H__ 
    9 #define ILANG_UTIL_FS_H__ 
   27                                   const std::string& dst);
 
   31                                   const std::string& dst);
 
   41                                    const std::string& dir2);
 
   45                                    const std::vector<std::string>& dirs);
 
   58   enum _failure { PREIO = 0, FORK = 1, ALARM, ARG, EXEC, WAIT, NONE } failure;
 
   68 enum redirect_t { NONE = 0, STDOUT = 1, STDERR = 2, BOTH = 3 };
 
   73                           const std::string& redirect_output_file = 
"",
 
   76                           const std::string& pid_file_name = 
"");
 
   98 #if (defined(__unix__) || defined(unix) || defined(__APPLE__) ||               \ 
   99      defined(__MACH__) || defined(__FreeBSD__)) &&                             \ 
  127 FILE* fmemopen_osx(
void* buf, 
size_t size, 
const char* mode);
 
  133 #endif // fmemopen_osx guard 
  137 #endif // ILANG_UTIL_FS_H__ 
bool os_portable_remove_file(const std::string &file)
Remove one file. 
 
std::string os_portable_path_from_path(const std::string &path)
 
double seconds
the execution time 
Definition: fs.h:64
 
bool os_portable_remove_directory(const std::string &dir)
Remove one directory. 
 
std::string os_portable_append_dir(const std::string &dir1, const std::string &dir2)
Append two paths. 
 
bool os_portable_copy_dir(const std::string &src, const std::string &dst)
Copy all file from a source dir to the destination dir. 
 
bool os_portable_move_file_to_dir(const std::string &src, const std::string &dst)
Move one file to the destination dir. 
 
bool os_portable_mkdir(const std::string &dir)
Create a dir, true -> suceeded , ow false. 
 
std::string os_portable_remove_file_name_extension(const std::string &fname)
C:\a.txt -> C:\a or /a/b/c.txt -> a/b/c. 
 
bool subexit_normal
true if it exits with _exit() call 
Definition: fs.h:62
 
bool os_portable_exist(const std::string &path)
Check if path exist. 
 
bool timeout
has timeout 
Definition: fs.h:56
 
the result from executing 
Definition: fs.h:54
 
redirect_t
the type of redirect 
Definition: fs.h:68
 
std::string os_portable_getcwd()
Get the current directory. 
 
bool os_portable_copy_file_to_dir(const std::string &src, const std::string &dst)
Copy one file to the destination dir. 
 
execute_result os_portable_execute_shell(const std::vector< std::string > &cmdargs, const std::string &redirect_output_file="", redirect_t rdt=redirect_t::BOTH, unsigned timeout=0, const std::string &pid_file_name="")
 
bool os_portable_chdir(const std::string &dirname)
Change current directory: true if success. 
 
std::string os_portable_read_last_line(const std::string &filename)
read the last meaningful line from a file 
 
std::string os_portable_file_name_from_path(const std::string &path)
 
unsigned ret
return value 
Definition: fs.h:60
 
_failure
failed execution 
Definition: fs.h:58
 
std::string os_portable_join_dir(const std::vector< std::string > &dirs)
Join paths.