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

Add a second output argument to CheckPath nonzero iff the routine creates a new directory.

parent 08199dc8
Branches
Tags
No related merge requests found
function DirectoryName = CheckPath(type,dname) function [DirectoryName, info] = CheckPath(type,dname)
% Creates the subfolder "./M_.dname/type" if it does not exist yet. % Creates the subfolder "./M_.dname/type" if it does not exist yet.
% %
% INPUTS % INPUTS
...@@ -6,12 +6,13 @@ function DirectoryName = CheckPath(type,dname) ...@@ -6,12 +6,13 @@ function DirectoryName = CheckPath(type,dname)
% dname [string] Name of the directory % dname [string] Name of the directory
% %
% OUTPUTS % OUTPUTS
% none. % DirectoryName string, name of the directory (with path).
% info integer scalar, equal to 1 if the routine creates directory dname/type, zero otherwise.
% %
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% none % none
% Copyright (C) 2005-2012 Dynare Team % Copyright (C) 2005-2013 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
...@@ -28,6 +29,8 @@ function DirectoryName = CheckPath(type,dname) ...@@ -28,6 +29,8 @@ function DirectoryName = CheckPath(type,dname)
% 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/>.
info = 0;
DirectoryName = [ dname '/' type ]; DirectoryName = [ dname '/' type ];
if ~isdir(dname) if ~isdir(dname)
...@@ -44,4 +47,5 @@ if ~isdir(DirectoryName) ...@@ -44,4 +47,5 @@ if ~isdir(DirectoryName)
delete(DirectoryName) delete(DirectoryName)
end end
mkdir('.',DirectoryName); mkdir('.',DirectoryName);
info = 1;
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment