# HG changeset patch # User John W. Eaton # Date 1465925009 14400 # Node ID 39afd54c2981b9eddce13668ff8928c685ddae4c # Parent 83c824c727c9aafd5ab6b51b9e39a3dc7f4d5512 perform tilde expansion for more file and directory functions * dirfns.cc (Freaddir, Flink, Fsymlink, Freadlink, Frename): Perform tilde expansion on filename arguments. diff -r 83c824c727c9 -r 39afd54c2981 libinterp/corefcn/dirfns.cc --- a/libinterp/corefcn/dirfns.cc Tue Jun 14 12:51:55 2016 -0400 +++ b/libinterp/corefcn/dirfns.cc Tue Jun 14 13:23:29 2016 -0400 @@ -179,6 +179,8 @@ octave_value_list retval = ovl (Cell (), -1.0, ""); + dirname = octave::sys::file_ops::tilde_expand (dirname); + octave::sys::dir_entry dir (dirname); if (dir) @@ -315,6 +317,9 @@ std::string from = args(0).xstring_value ("link: OLD must be a string"); std::string to = args(1).xstring_value ("link: NEW must be a string"); + from = octave::sys::file_ops::tilde_expand (from); + to = octave::sys::file_ops::tilde_expand (to); + std::string msg; int status = octave::sys::link (from, to, msg); @@ -343,6 +348,9 @@ std::string from = args(0).xstring_value ("symlink: OLD must be a string"); std::string to = args(1).xstring_value ("symlink: NEW must be a string"); + from = octave::sys::file_ops::tilde_expand (from); + to = octave::sys::file_ops::tilde_expand (to); + std::string msg; int status = octave::sys::symlink (from, to, msg); @@ -371,6 +379,8 @@ std::string symlink = args(0).xstring_value ("readlink: SYMLINK must be a string"); + symlink = octave::sys::file_ops::tilde_expand (symlink); + std::string result, msg; int status = octave::sys::readlink (symlink, result, msg); @@ -399,6 +409,9 @@ std::string from = args(0).xstring_value ("rename: OLD must be a string"); std::string to = args(1).xstring_value ("rename: NEW must be a string"); + from = octave::sys::file_ops::tilde_expand (from); + to = octave::sys::file_ops::tilde_expand (to); + std::string msg; int status = octave::sys::rename (from, to, msg);