From 3dd62b37c6f4329e45835272a3b9cad776ccdbb5 Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx,de>
Date: Fri, 4 Oct 2013 19:39:54 +0200
Subject: [PATCH] Add more explicit error message if mod-file cannot be located
 of file in different folder is called

---
 matlab/dynare.m | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/matlab/dynare.m b/matlab/dynare.m
index baa87a788d..793a33886a 100644
--- a/matlab/dynare.m
+++ b/matlab/dynare.m
@@ -93,7 +93,13 @@ else
 end;
 d = dir(fname);
 if length(d) == 0
+    fprintf('\nThe file %s could not be located in the "Current Folder". Check whether you typed in the correct filename\n',fname)
+    fprintf('and whether the file is really located in the "Current Folder".\n')
     error(['DYNARE: can''t open ' fname])
+elseif ~isempty(strfind(fname,'\')) || ~isempty(strfind(fname,'/'))
+    fprintf('\nIt seems you are trying to call a mod-file not located in the "Current Folder". This is not possible.\n')
+    fprintf('Please set your "Current Folder" to the folder where the mod-file is located.\n')
+    error(['DYNARE: can''t open ' fname, '. It seems to be located in a different folder (or has an invalid filename).'])        
 end
 
 % pre-dynare-preprocessor-hook
-- 
GitLab