26 #if defined (HAVE_CONFIG_H)
100 int nargin = args.length ();
112 std::string
dirname = args(0).xstring_value (
"cd: DIR must be a string");
117 else if (nargout == 0)
121 if (! home_dir.empty ())
122 interp.chdir (home_dir);
141 DEFUN (readdir, args, ,
155 if (args.length () != 1)
158 std::string
dirname = args(0).xstring_value (
"readdir: DIR must be a string");
181 DEFUN (__mkdir__, args, ,
188 int nargin = args.length ();
190 if (nargin < 1 || nargin > 2)
197 std::string parent = args(0).xstring_value (
"mkdir: PARENT must be a string");
198 std::string dir = args(1).xstring_value (
"mkdir: DIR must be a string");
202 else if (nargin == 1)
203 dirname = args(0).xstring_value (
"mkdir: DIR must be a string");
212 return ovl (
true,
"directory exists",
"mkdir");
221 return ovl (
false, msg,
"mkdir");
223 return ovl (
true,
"",
"");
245 int nargin = args.length ();
247 if (nargin < 1 || nargin > 2)
250 std::string
dirname = args(0).xstring_value (
"rmdir: DIR must be a string");
260 if (args(1).string_value () !=
"s")
261 error (R
"(rmdir: second argument must be "s" for recursive removal)");
265 if (interp.interactive ()
271 std::string prompt =
"remove entire contents of " + fulldir +
"? ";
291 return ovl (
false, msg,
"rmdir");
293 return ovl (
true,
"",
"");
308 if (args.length () != 2)
311 std::string from = args(0).xstring_value (
"link: OLD must be a string");
312 std::string to = args(1).xstring_value (
"link: NEW must be a string");
322 return ovl (-1.0, msg);
324 return ovl (status,
"");
339 if (args.length () != 2)
342 std::string from = args(0).xstring_value (
"symlink: OLD must be a string");
343 std::string to = args(1).xstring_value (
"symlink: NEW must be a string");
353 return ovl (-1.0, msg);
355 return ovl (status,
"");
371 if (args.length () != 1)
374 std::string
symlink = args(0).xstring_value (
"readlink: SYMLINK must be a string");
378 std::string result, msg;
383 return ovl (
"", -1.0, msg);
385 return ovl (result, status,
"");
400 if (args.length () != 2)
403 std::string from = args(0).xstring_value (
"rename: OLD must be a string");
404 std::string to = args(1).xstring_value (
"rename: NEW must be a string");
420 return ovl (-1.0, msg);
425 return ovl (status,
"");
480 if (args.length () != 1)
483 string_vector pat = args(0).xstring_vector_value (
"glob: PATTERN must be a string");
491 DEFUN (__wglob__, args, ,
547 if (args.length () == 0)
589 DEFUN (__fnmatch__, args, ,
607 if (args.length () != 2)
618 DEFUN (filesep, args, ,
631 int nargin = args.length ();
642 std::string s = args(0).xstring_value (
"filesep: argument must be a string");
644 error (R
"(filesep: argument must be "all")");
652 DEFUN (pathsep, args, ,
659 int nargin = args.length ();
667 DEFUN (confirm_recursive_rmdir, args, nargout,
string_vector glob(void) const
bool match(const std::string &str) const
static bool forced_interactive(void)
static std::string path_sep_str(void)
Provides threadsafe access to octave.
void file_renamed(bool load_new)
void file_remove(const std::string &old_name, const std::string &new_name)
static std::string get_home_directory(void)
static std::string get_current_directory(void)
string_vector & sort(bool make_uniq=false)
OCTINTERP_API void print_usage(void)
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
#define DEFUNX(name, fname, args_name, nargout_name, doc)
Macro to define a builtin function with certain internal name.
#define DEFALIAS(alias, name)
Macro to define an alias for another existing function name.
static bool Vconfirm_recursive_rmdir
OCTAVE_EXPORT octave_value_list Flink(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Frmdir(octave::interpreter &interp, const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fsymlink(const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Frename(octave::interpreter &interp, const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Freadlink(const octave_value_list &args, int)
void error(const char *fmt,...)
std::string dirname(const std::string &path)
std::string dir_sep_str(void)
std::string tilde_expand(const std::string &name)
std::string concat(const std::string &dir, const std::string &file)
std::string dir_sep_chars(void)
int link(const std::string &old_name, const std::string &new_name)
int readlink(const std::string &path, std::string &result)
int rename(const std::string &from, const std::string &to)
string_vector windows_glob(const string_vector &pat)
int mkdir(const std::string &nm, mode_t md)
int symlink(const std::string &old_name, const std::string &new_name)
int rmdir(const std::string &name)
int recursive_rmdir(const std::string &name)
int chdir(const std::string &path_arg)
string_vector glob(const string_vector &pat)
bool get_dirlist(const std::string &dirname, string_vector &dirlist, std::string &msg)
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
octave_value::octave_value(const Array< char > &chm, char type) return retval
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
DEFMETHODX("quad", Fquad, interp, args,, doc:)
#define SET_INTERNAL_VARIABLE(NM)