Mercurial > octave
comparison scripts/testfun/runtests.m @ 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 | ff05d5b70411 |
comparison
equal
deleted
inserted
replaced
18054:70e83c641b48 | 18059:b675665ce328 |
---|---|
34 | 34 |
35 if (nargin == 0) | 35 if (nargin == 0) |
36 dirs = ostrsplit (path (), pathsep ()); | 36 dirs = ostrsplit (path (), pathsep ()); |
37 do_class_dirs = true; | 37 do_class_dirs = true; |
38 elseif (nargin == 1) | 38 elseif (nargin == 1) |
39 if (is_absolute_filename (directory)) | 39 dirs = {canonicalize_file_name(directory)}; |
40 dirs = {directory}; | 40 if (isempty (dirs{1})) |
41 elseif (isdir (directory)) | 41 ## Search for directory name in path |
42 dirs = {canonicalize_file_name(directory)}; | 42 if (directory(end) == '/' || directory(end) == '\') |
43 else | 43 directory(end) = []; |
44 if (directory(end) == filesep ()) | |
45 directory = directory(1:end-1); | |
46 endif | 44 endif |
47 fullname = find_dir_in_path (directory); | 45 fullname = find_dir_in_path (directory); |
48 if (isempty (fullname)) | 46 if (isempty (fullname)) |
49 error ("runtests: DIRECTORY argument must be a valid pathname"); | 47 error ("runtests: DIRECTORY argument must be a valid pathname"); |
50 endif | 48 endif |