Mercurial > hg > octave-nkf
changeset 18059:b675665ce328
Simplify directory testing code for rundemos, runtests.
* rundemos.m, runtests.m: Use canonicalize_file_name to both check
for existence of file and return and absolute path.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 03 Dec 2013 10:45:20 -0800 |
parents | 70e83c641b48 |
children | 427412d40f1a |
files | scripts/testfun/rundemos.m scripts/testfun/runtests.m |
diffstat | 2 files changed, 10 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/testfun/rundemos.m +++ b/scripts/testfun/rundemos.m @@ -36,13 +36,11 @@ dirs = ostrsplit (path (), pathsep ()); do_class_dirs = true; elseif (nargin == 1) - if (is_absolute_filename (directory)) - dirs = {directory}; - elseif (isdir (directory)) - dirs = {canonicalize_file_name(directory)}; - else - if (directory(end) == filesep ()) - directory = directory(1:end-1); + dirs = {canonicalize_file_name(directory)}; + if (isempty (dirs{1})) + ## Search for directory name in path + if (directory(end) == '/' || directory(end) == '\') + directory(end) = []; endif fullname = find_dir_in_path (directory); if (isempty (fullname))
--- a/scripts/testfun/runtests.m +++ b/scripts/testfun/runtests.m @@ -36,13 +36,11 @@ dirs = ostrsplit (path (), pathsep ()); do_class_dirs = true; elseif (nargin == 1) - if (is_absolute_filename (directory)) - dirs = {directory}; - elseif (isdir (directory)) - dirs = {canonicalize_file_name(directory)}; - else - if (directory(end) == filesep ()) - directory = directory(1:end-1); + dirs = {canonicalize_file_name(directory)}; + if (isempty (dirs{1})) + ## Search for directory name in path + if (directory(end) == '/' || directory(end) == '\') + directory(end) = []; endif fullname = find_dir_in_path (directory); if (isempty (fullname))