2013-12-13 15:47:56 +01:00
|
|
|
function [DirectoryName, info] = CheckPath(type,dname)
|
2009-12-16 18:17:34 +01:00
|
|
|
% Creates the subfolder "./M_.dname/type" if it does not exist yet.
|
|
|
|
%
|
|
|
|
% INPUTS
|
2017-05-16 15:10:20 +02:00
|
|
|
% type [string] Name of the subfolder.
|
2011-12-15 11:56:23 +01:00
|
|
|
% dname [string] Name of the directory
|
2009-12-16 18:17:34 +01:00
|
|
|
%
|
|
|
|
% OUTPUTS
|
2013-12-13 15:47:56 +01:00
|
|
|
% DirectoryName string, name of the directory (with path).
|
|
|
|
% info integer scalar, equal to 1 if the routine creates directory dname/type, zero otherwise.
|
2009-12-16 18:17:34 +01:00
|
|
|
%
|
|
|
|
% SPECIAL REQUIREMENTS
|
|
|
|
% none
|
|
|
|
|
2017-05-18 18:36:38 +02:00
|
|
|
% Copyright (C) 2005-2017 Dynare Team
|
2009-12-16 18:17:34 +01:00
|
|
|
%
|
|
|
|
% This file is part of Dynare.
|
|
|
|
%
|
|
|
|
% Dynare is free software: you can redistribute it and/or modify
|
|
|
|
% it under the terms of the GNU General Public License as published by
|
|
|
|
% the Free Software Foundation, either version 3 of the License, or
|
|
|
|
% (at your option) any later version.
|
|
|
|
%
|
|
|
|
% Dynare is distributed in the hope that it will be useful,
|
|
|
|
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
% GNU General Public License for more details.
|
|
|
|
%
|
|
|
|
% You should have received a copy of the GNU General Public License
|
|
|
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2013-12-13 15:47:56 +01:00
|
|
|
info = 0;
|
|
|
|
|
2011-12-15 11:56:23 +01:00
|
|
|
DirectoryName = [ dname '/' type ];
|
2009-12-16 18:17:34 +01:00
|
|
|
|
2011-12-15 11:56:23 +01:00
|
|
|
if ~isdir(dname)
|
2009-12-16 18:17:34 +01:00
|
|
|
% Make sure there isn't a file with the same name, see trac ticket #47
|
2012-09-06 12:22:32 +02:00
|
|
|
if isfile(dname)
|
|
|
|
delete(dname)
|
|
|
|
end
|
2011-12-15 11:56:23 +01:00
|
|
|
mkdir('.', dname);
|
2009-12-16 18:17:34 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
if ~isdir(DirectoryName)
|
|
|
|
% Make sure there isn't a file with the same name, see trac ticket #47
|
2012-09-06 12:22:32 +02:00
|
|
|
if isfile(DirectoryName)
|
|
|
|
delete(DirectoryName)
|
|
|
|
end
|
2009-12-16 18:17:34 +01:00
|
|
|
mkdir('.',DirectoryName);
|
2013-12-13 15:47:56 +01:00
|
|
|
info = 1;
|
2009-12-16 18:17:34 +01:00
|
|
|
end
|