23 #if defined (HAVE_CONFIG_H) 32 #if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)) 71 size_t s_len =
s.length ();
73 if (s_len == 0 ||
s[0] ==
'~')
78 if (! prefixes.
empty ())
80 for (
size_t i = 0;
i < s_len;
i++)
82 for (
int j = 0; j < prefixes.
numel (); j++)
84 size_t pfx_len = prefixes[j].
length ();
86 if (prefixes[j] ==
s.substr (
i, pfx_len))
104 size_t s_len =
s.length ();
110 for ( ;
i < s_len;
i++)
115 if (! suffixes.
empty ())
117 for (
int j = 0; j < suffixes.
numel (); j++)
119 size_t sfx_len = suffixes[j].
length ();
121 if (suffixes[j] ==
s.substr (
i, sfx_len))
135 size_t f_len =
fname.length ();
142 return fname.substr (1, len);
153 if (f_len == 0 ||
filename[0] !=
'~')
165 size_t user_len = username.length ();
174 if (! expansion.empty ())
175 return expansion +
filename.substr (user_len+1);
193 if (! expansion.empty ())
217 #if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)) 226 #if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)) 235 #if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)) 244 #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) 261 #if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)) 264 octave_unused_parameter (
c);
273 return tmp.find (
c) != std::string::npos;
278 if (
name.find (
'~') == std::string::npos)
284 size_t name_len =
name.length ();
314 if (! (
start || fini))
325 result.append (expansion);
334 int n = names.
numel ();
338 for (
int i = 0;
i < n;
i++)
357 return (ipos != std::string::npos) ? path.substr (0, ipos) :
"";
364 if (ipos != std::string::npos)
369 return path.substr (ipos);
380 size_t n = path.
length ();
381 for (
size_t i = 0;
i < n;
i++)
407 msg = std::strerror (errno);
425 msg = std::strerror (errno);
433 return link (old_name, new_name, msg);
446 msg = std::strerror (errno);
454 return symlink (old_name, new_name, msg);
467 msg = std::strerror (errno);
487 msg = std::strerror (errno);
501 return rename (from, to, msg);
513 msg = std::strerror (errno);
533 msg = std::strerror (errno);
565 if (
nm ==
"." ||
nm ==
"..")
584 status =
unlink (fullnm, msg);
633 msg = std::strerror (errno);
641 return tempnam (dir, pfx, msg);
665 templatename +=
"file";
670 templatename +=
"XXXXXX";
673 char tname [templatename.length () + 1];
675 strcpy (tname, templatename.c_str ());
678 msg = std::strerror (errno);
705 #if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)) 707 std::replace (
retval.begin (),
retval.end (),
'/',
'\\');
711 msg = std::strerror (errno);
std::string error(void) const
static password getpwnam(const std::string &nm)
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)
std::string dir(void) const
int unlink(const std::string &name)
int octave_rmdir_wrapper(const char *nm)
std::string dir_sep_chars(void)
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)
std::string tempnam(const std::string &dir, const std::string &pfx)
static size_t tilde_find_suffix(const std::string &s)
std::string tail(const std::string &path)
std::string tilde_expand(const std::string &name)
std::string native_separator_path(const std::string &path)
std::string dirname(const std::string &path)
string_vector tilde_additional_prefixes
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
tilde_expansion_hook tilde_expansion_failure_hook
int octave_gen_tempname_wrapper(char *tmpl)
std::string dir_sep_str(void)
int recursive_rmdir(const std::string &name)
int rename(const std::string &from, const std::string &to)
int octave_symlink_wrapper(const char *nm1, const char *nm2)
string_vector tilde_additional_suffixes
std::string concat(const std::string &dir, const std::string &file)
nd deftypefn *std::string name
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
static std::string get_home_directory(void)
static const char * default_suffixes[]
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)
static const char * default_prefixes[]
static size_t tilde_find_prefix(const std::string &s, size_t &len)
static std::string tilde_expand_word(const std::string &filename)
char * octave_canonicalize_file_name_wrapper(const char *name)
int octave_umask_wrapper(mode_t mode)
static std::string isolate_tilde_prefix(const std::string &fname)
With real return the complex result
tilde_expansion_hook tilde_expansion_preexpansion_hook
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)
std::string(* tilde_expansion_hook)(const std::string &)
std::string error(void) const
int readlink(const std::string &path, std::string &result)
octave::sys::file_stat fs(filename)
int octave_mkdir_wrapper(const char *name, mode_t mode)
int rename(const std::string &from, const std::string &to, std::string &msg)
octave_idx_type numel(void) const
Number of elements in the array.
octave_idx_type length(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
octave_idx_type length(void) const
Number of elements in the array.
int mkfifo(const std::string &nm, mode_t md)