From 5f247b32c4313fcf54a4620a8f13914cbe29be3d Mon Sep 17 00:00:00 2001 From: sebastien Date: Mon, 12 Oct 2009 16:32:10 +0000 Subject: [PATCH] CheckPath.m: give more informative error message when trying to create a subdirectory, when a file with the same name already exists git-svn-id: https://www.dynare.org/svn/dynare/trunk@3037 ac1d8469-bf42-47a9-8791-bf33cf982152 --- matlab/CheckPath.m | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/matlab/CheckPath.m b/matlab/CheckPath.m index c20c245c3..0e8e52838 100644 --- a/matlab/CheckPath.m +++ b/matlab/CheckPath.m @@ -32,9 +32,15 @@ global M_ DirectoryName = [ M_.dname '/' type ]; if ~isdir(M_.dname) - mkdir('.', M_.dname); + if exist(M_.dname, 'file') + error(['Can''t create subdirectory. You should erase the following file: ' M_.dname]) + end + mkdir('.', M_.dname); end if ~isdir(DirectoryName) + if exist(DirectoryName, 'file') + error(['Can''t create subdirectory. You should erase the following file: ' DirectoryName]) + end mkdir('.',DirectoryName); -end \ No newline at end of file +end