23 #if !defined (octave_file_ops_h)
24 #define octave_file_ops_h 1
28 #include <sys/types.h>
43 const std::string& dir_sep_str_arg = std::string (
"/"),
44 const std::string& dir_sep_chars_arg = std::string (
"/"))
45 : xdir_sep_char (dir_sep_char_arg), xdir_sep_str (dir_sep_str_arg),
46 xdir_sep_chars (dir_sep_chars_arg) { }
48 typedef std::string (*tilde_expansion_hook) (
const std::string&);
60 return instance_ok () ? instance->xdir_sep_char : 0;
63 static std::string dir_sep_str (
void)
65 return instance_ok () ? instance->xdir_sep_str : std::string ();
68 static std::string dir_sep_chars (
void)
70 return instance_ok () ? instance->xdir_sep_chars : std::string ();
73 static bool is_dir_sep (
char c)
75 std::string tmp = dir_sep_chars ();
76 return tmp.find (c) != std::string::npos;
79 static std::string tilde_expand (
const std::string&);
83 static std::string
concat (
const std::string&,
const std::string&);
86 static std::string tail (
const std::string& path)
88 size_t ipos = path.find_last_of (dir_sep_chars ());
90 if (ipos != std::string::npos)
95 return path.substr (ipos);
110 static bool instance_ok (
void);
121 extern OCTAVE_API
int
124 extern OCTAVE_API
int
127 extern OCTAVE_API
int
130 extern OCTAVE_API
int
133 extern OCTAVE_API
int
134 octave_link (
const std::string&,
const std::string&);
136 extern OCTAVE_API
int
137 octave_link (
const std::string&,
const std::string&, std::string&);
139 extern OCTAVE_API
int
142 extern OCTAVE_API
int
143 octave_symlink (
const std::string&,
const std::string&, std::string&);
145 extern OCTAVE_API
int
148 extern OCTAVE_API
int
151 extern OCTAVE_API
int
154 extern OCTAVE_API
int
155 octave_rename (
const std::string&,
const std::string&, std::string&);
157 extern OCTAVE_API
int
160 extern OCTAVE_API
int
163 extern OCTAVE_API
int
166 extern OCTAVE_API
int
169 extern OCTAVE_API
int
172 extern OCTAVE_API
int
175 extern OCTAVE_API
int
178 extern OCTAVE_API std::string
181 extern OCTAVE_API std::string
182 octave_tempnam (
const std::string&,
const std::string&, std::string&);
184 extern OCTAVE_API std::string
187 extern OCTAVE_API std::string