Back to index

texmacs  1.0.7.15
file.hpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : file.hpp
00004 * DESCRIPTION: file handling
00005 * COPYRIGHT  : (C) 1999  Joris van der Hoeven
00006 *******************************************************************************
00007 * This software falls under the GNU general public license version 3 or later.
00008 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00009 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
00010 ******************************************************************************/
00011 
00012 #ifndef FILE_H
00013 #define FILE_H
00014 #include "url.hpp"
00015 #include "sys_utils.hpp"
00016 #include "analyze.hpp"
00017 
00018 bool load_string (url file_name, string& s, bool fatal);
00019 bool save_string (url file_name, string s, bool fatal=false);
00020 
00021 bool is_of_type (url name, string filter);
00022 bool is_regular (url name);
00023 bool is_directory (url name);
00024 bool is_symbolic_link (url name);
00025 bool is_newer (url which, url than);
00026 int  last_modified (url u, bool cache_flag= true);
00027 url  url_temp (string suffix= "");
00028 url  url_numbered (url dir, string prefix, string postfix, int i=1);
00029 url  url_scratch (string prefix= "no_name_", string postfix= ".tm", int i=1);
00030 bool is_scratch (url u);
00031 
00032 array<string> read_directory (url name, bool& error_flag);
00033 
00034 inline string sys_concretize (url u1) {
00035   return escape_sh (concretize (u1)); }
00036 
00037 inline void system (string which, url u1) {
00038   system (which * " " * sys_concretize (u1)); }
00039 inline void system (string which, url u1, url u2) {
00040   system (which * " " * sys_concretize (u1) * " " * sys_concretize (u2)); }
00041 inline void system (string which, url u1, const char* post) {
00042   system (which * " " * sys_concretize (u1) * " " * post); }
00043 inline void system (string which, url u1, const char* sep, url u2) {
00044   system (which * " " * sys_concretize (u1) * " " * sep *
00045                  " " * sys_concretize (u2)); }
00046 inline string eval_system (string which, url u1) {
00047   return eval_system (which * " " * escape_sh (concretize (u1))); }
00048 inline string eval_system (string which, url u1, url u2) {
00049   return eval_system (which * " " * escape_sh (concretize (u1)) * " " * escape_sh (concretize (u2))); }
00050 
00051 void move (url from, url to);
00052 void copy (url from, url to);
00053 void remove (url what);
00054 void mkdir (url dir);
00055 void change_mode (url u, int mode);
00056 void ps2pdf (url u1, url u2);
00057 
00058 int search_score (url u, array<string> a);
00059 
00060 array<string> file_completions (url search, url dir);
00061 
00062 #endif // defined FILE_H