23 #if defined (HAVE_CONFIG_H)
32 #if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM))
67 #if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM))
68 char system_dev_sep_char =
':';
69 char system_dir_sep_char =
'\\';
72 char system_dev_sep_char = 0;
73 char system_dir_sep_char =
'/';
76 #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM)
79 std::string system_dir_sep_chars = system_dir_sep_str;
82 instance =
new file_ops (system_dev_sep_char, system_dir_sep_char,
83 system_dir_sep_str, system_dir_sep_chars);
90 (*current_liboctave_error_handler)
91 (
"unable to create file_ops object!");
147 size_t s_len = s.length ();
149 if (s_len == 0 || s[0] ==
'~')
154 if (! prefixes.
empty ())
156 for (
size_t i = 0;
i < s_len;
i++)
158 for (
int j = 0; j < prefixes.
numel (); j++)
160 size_t pfx_len = prefixes[j].
length ();
162 if (prefixes[j] == s.substr (
i, pfx_len))
180 size_t s_len = s.length ();
186 for ( ; i < s_len; i++)
191 if (! suffixes.
empty ())
193 for (
int j = 0; j < suffixes.
numel (); j++)
195 size_t sfx_len = suffixes[j].
length ();
197 if (suffixes[j] == s.substr (i, sfx_len))
211 size_t f_len = fname.length ();
218 return fname.substr (1, len);
227 size_t f_len = filename.length ();
229 if (f_len == 0 || filename[0] !=
'~')
241 size_t user_len = username.length ();
245 if (octave::sys::file_ops::tilde_expansion_preexpansion_hook)
250 if (! expansion.empty ())
251 return expansion + filename.substr (user_len+1);
264 if (octave::sys::file_ops::tilde_expansion_failure_hook)
269 if (! expansion.empty ())
270 dirname = expansion + filename.substr (user_len+1);
276 if (dirname.empty ())
280 dirname = pw.
dir () + filename.substr (user_len+1);
288 #if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM))
289 return c == dev_sep_char ();
291 octave_unused_parameter (c);
303 if (name.find (
'~') == std::string::npos)
309 size_t name_len = name.length ();
326 result.append (name.substr (pos, start));
339 if (! (start || fini))
350 result.append (expansion);
364 int n = names.
numel ();
368 for (
int i = 0;
i < n;
i++)
369 retval[
i] = tilde_expand (names[
i]);
379 : (is_dir_sep (dir[dir.length ()-1])
393 size_t n = path.
length ();
394 for (
size_t i = 0;
i < n;
i++)
421 msg = std::strerror (errno);
430 return mkfifo (nm, md, msg);
441 msg = std::strerror (errno);
450 return link (old_name, new_name, msg);
464 msg = std::strerror (errno);
473 return symlink (old_name, new_name, msg);
487 msg = std::strerror (errno);
496 return readlink (path, result, msg);
509 msg = std::strerror (errno);
524 return rename (from, to, msg);
537 msg = std::strerror (errno);
546 return rmdir (name, msg);
559 msg = std::strerror (errno);
593 if (nm ==
"." || nm ==
"..")
612 status =
unlink (fullnm, msg);
628 status =
rmdir (name, msg);
651 return unlink (name, msg);
664 msg = std::strerror (errno);
673 return tempnam (dir, pfx, msg);
698 templatename +=
"file";
703 templatename +=
"XXXXXX";
706 char tname [templatename.length () + 1];
708 strcpy (tname, templatename.c_str ());
711 msg = std::strerror (errno);
740 #if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM))
742 std::replace (retval.begin (), retval.end (),
'/',
'\\');
746 msg = std::strerror (errno);
static std::string dir_sep_str(void)
static password getpwnam(const std::string &nm)
static const char * default_prefixes[]
Octave interface to the compression and uncompression libraries.
For example cd octave end example noindent changes the current working directory to file
std::string canonicalize_file_name(const std::string &name)
int octave_link_wrapper(const char *nm1, const char *nm2)
int unlink(const std::string &name)
static bool instance_ok(void)
int octave_rmdir_wrapper(const char *nm)
octave_idx_type numel(void) const
Number of elements in the array.
int symlink(const std::string &old_name, const std::string &new_name)
Return the CPU time used by your Octave session The first output is the total time spent executing your process and is equal to the sum of second and third which are the number of CPU seconds spent executing in user mode and the number of CPU seconds spent executing in system mode
char * octave_areadlink_wrapper(const char *name)
static bool is_dev_sep(char c)
std::string tempnam(const std::string &dir, const std::string &pfx)
static string_vector tilde_additional_prefixes
static tilde_expansion_hook tilde_expansion_preexpansion_hook
static std::string tilde_expand(const std::string &)
void resize(octave_idx_type n, const std::string &rfv="")
static size_t tilde_find_suffix(const std::string &s)
int octave_gen_tempname_wrapper(char *tmpl)
static file_ops * instance
int recursive_rmdir(const std::string &name)
int rename(const std::string &from, const std::string &to)
static std::string isolate_tilde_prefix(const std::string &fname)
static const char * default_suffixes[]
int octave_symlink_wrapper(const char *nm1, const char *nm2)
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
std::string dir(void) const
static void replace(QString &text, const QRegExp &re, const QString &after)
static std::string get_home_directory(void)
static std::string get_temp_directory(void)
int octave_unlink_wrapper(const char *nm)
int link(const std::string &old_name, const std::string &new_name)
char * octave_canonicalize_file_name_wrapper(const char *name)
static char dir_sep_char(void)
static const char dir_sep_char
static tilde_expansion_hook tilde_expansion_failure_hook
octave_idx_type length(void) const
static size_t tilde_find_prefix(const std::string &s, size_t &len)
int octave_umask_wrapper(mode_t mode)
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
may be zero for pure relative error test tem the relative tolerance must be greater than or equal to
With real return the complex result
static std::string concat(const std::string &, const std::string &)
std::string(* tilde_expansion_hook)(const std::string &)
octave_idx_type length(void) const
Number of elements in the array.
int mkdir(const std::string &nm, mode_t md)
int rmdir(const std::string &name)
int octave_mkfifo_wrapper(const char *name, mode_t mode)
=val(i)}if ode{val(i)}occurs in table i
static std::string native_separator_path(const std::string &path)
static std::string tilde_expand_word(const std::string &filename)
int readlink(const std::string &path, std::string &result)
octave::sys::file_stat fs(filename)
static string_vector tilde_additional_suffixes
std::string error(void) const
int octave_mkdir_wrapper(const char *name, mode_t mode)
int rename(const std::string &from, const std::string &to, std::string &msg)
std::string error(void) const
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
static bool is_dir_sep(char c)
int mkfifo(const std::string &nm, mode_t md)