Skip to content
Snippets Groups Projects
Commit fdc13f0f authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Set default value for input argument, filter out files without an m

extension, and fixed the header.
parent 8335e840
Branches
Tags
No related merge requests found
function flist = get_directory_description(basedir) function flist = get_directory_description(basedir)
% Copyright (C) 2013 Dynare Team % List recursively all the *.m files in a directory.
% %
% This file is part of Dynare. % INPUTS
% - basedir [string], the name of the directory to be inspected.
%
% OUTPUTS
% - flist [cell of strings], the files under basedir (and subfolders).
% Copyright (C) 2013-2014 Dynare Team
%
% This file is part of Dynare (m-unit-tests module).
% %
% Dynare is free software: you can redistribute it and/or modify % Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by % it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or % the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version. % (at your option) any later version.
% %
% Dynare is distributed in the hope that it will be useful, % Dynare's m-unit-tests module is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of % but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
% GNU General Public License for more details. % more details.
% %
% You should have received a copy of the GNU General Public License % You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if ~nargin || isempty(basedir)
% Current directory is the default value of basedir
basedir = '.';
end
dd = dir(basedir); dd = dir(basedir);
flist = {}; flist = {};
file = 1; file = 1;
...@@ -27,8 +40,11 @@ for f=1:length(dd) ...@@ -27,8 +40,11 @@ for f=1:length(dd)
r = get_directory_description([ basedir filesep dd(f).name]); r = get_directory_description([ basedir filesep dd(f).name]);
flist = { flist{:} r{:} }; flist = { flist{:} r{:} };
else else
flist{length(flist)+1} = [basedir filesep dd(f).name]; % Filter out files without m extension.
if isequal(dd(f).name(end-1:end),'.m')
flist{length(flist)+1} = [basedir filesep dd(f).name];
end
end end
file = file + 1; file = file + 1;
end end
end end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment