Mercurial > hg > octave-nkf
changeset 19474:a834b3151c7e
run.m: Return to the intial directory, unless the pwd is changed (Bug #43426).
* run.m: Expand the script's dir.
author | Andy Weber <andreas.weber@hs-offenburg.de> |
---|---|
date | Sat, 18 Oct 2014 13:52:31 -0400 |
parents | 4b8b942ef8db |
children | e1713e281ac5 |
files | scripts/miscellaneous/run.m |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/miscellaneous/run.m +++ b/scripts/miscellaneous/run.m @@ -60,14 +60,15 @@ if (! isempty (d)) if (exist (d, "dir")) - wd = pwd (); + startdir = pwd (); + d = canonicalize_file_name (d); unwind_protect cd (d); evalin ("caller", sprintf ('source ("%s%s");', f, ext), "rethrow (lasterror ())"); unwind_protect_cleanup if (strcmp (d, pwd ())) - cd (wd); + cd (startdir); endif end_unwind_protect else