23 #if defined (HAVE_CONFIG_H) 79 error (
"%s: %s", newdir.c_str (), std::strerror (errno));
126 int nargin = args.length ();
147 if (! home_dir.empty ())
167 DEFUN (readdir, args, ,
181 if (args.length () != 1)
207 DEFUN (__mkdir__, args, ,
214 int nargin = args.length ();
223 std::string parent = args(0).xstring_value (
"mkdir: PARENT must be a string");
224 std::string dir = args(1).xstring_value (
"mkdir: DIR must be a string");
229 dirname = args(0).xstring_value (
"mkdir: DIR must be a string");
238 return ovl (
true,
"directory exists",
"mkdir");
247 return ovl (
false, msg,
"mkdir");
249 return ovl (
true,
"",
"");
253 DEFUNX (
"rmdir", Frmdir, args, ,
271 int nargin = args.length ();
284 if (args(1).string_value () !=
"s")
285 error (R
"(rmdir: second argument must be "s" for recursive removal)"); 289 if (octave::application::interactive ()
290 && ! octave::application::forced_interactive ()
293 std::string prompt =
"remove entire contents of " + fulldir +
"? ";
305 return ovl (
false, msg,
"rmdir");
307 return ovl (
true,
"",
"");
310 DEFUNX (
"link", Flink, args, ,
322 if (args.length () != 2)
325 std::string from = args(0).xstring_value (
"link: OLD must be a string");
326 std::string to = args(1).xstring_value (
"link: NEW must be a string");
336 return ovl (-1.0, msg);
338 return ovl (status,
"");
341 DEFUNX (
"symlink", Fsymlink, args, ,
353 if (args.length () != 2)
356 std::string from = args(0).xstring_value (
"symlink: OLD must be a string");
357 std::string to = args(1).xstring_value (
"symlink: NEW must be a string");
367 return ovl (-1.0, msg);
369 return ovl (status,
"");
372 DEFUNX (
"readlink", Freadlink, args, ,
385 if (args.length () != 1)
397 return ovl (
"", -1.0, msg);
402 DEFUNX (
"rename", Frename, args, ,
414 if (args.length () != 2)
417 std::string from = args(0).xstring_value (
"rename: OLD must be a string");
418 std::string to = args(1).xstring_value (
"rename: NEW must be a string");
428 return ovl (-1.0, msg);
430 return ovl (status,
"");
484 if (args.length () != 1)
487 string_vector pat = args(0).xstring_vector_value (
"glob: PATTERN must be a string");
495 DEFUN (__wglob__, args, ,
551 if (args.length () == 0)
593 DEFUN (__fnmatch__, args, ,
611 if (args.length () != 2)
622 DEFUN (filesep, args, ,
635 int nargin = args.length ();
646 std::string s = args(0).xstring_value (
"filesep: argument must be a string");
648 error (R
"(filesep: argument must be "all")"); 656 DEFUN (pathsep, args, ,
663 int nargin = args.length ();
static std::string get_current_directory(void)
static bool chdir(const std::string &newdir)
OCTINTERP_API void print_usage(void)
std::string dir_sep_chars(void)
static void change_directory(const std::string &dir)
int symlink(const std::string &old_name, const std::string &new_name)
static int octave_change_to_directory(const std::string &newdir)
static std::string path_sep_str(void)
std::string tilde_expand(const std::string &name)
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void error(const char *fmt,...)
#define SET_INTERNAL_VARIABLE(NM)
std::string dirname(const std::string &path)
static bool Vconfirm_recursive_rmdir
std::string dir_sep_str(void)
int recursive_rmdir(const std::string &name)
int rename(const std::string &from, const std::string &to)
#define DEFALIAS(alias, name)
Macro to define an alias for another existing function name.
std::string concat(const std::string &dir, const std::string &file)
string_vector windows_glob(const string_vector &pat)
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
static std::string get_home_directory(void)
int link(const std::string &old_name, const std::string &new_name)
#define DEFUNX(name, fname, args_name, nargout_name, doc)
Macro to define a builtin function with certain internal name.
string_vector & sort(bool make_uniq=false)
is longer than or if then or only for unique occurrences of the complete pattern(false). The default is true. If a cell array of strings ar
load_path & __get_load_path__(const std::string &who)
octave::sys::time Vlast_chdir_time
With real return the complex result
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
int mkdir(const std::string &nm, mode_t md)
int rmdir(const std::string &name)
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).isinteger())
int chdir(const std::string &path_arg)
std::string error(void) const
int readlink(const std::string &path, std::string &result)
octave::sys::file_stat fs(filename)
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
string_vector glob(const string_vector &pat)