From c391876196615a438a808ef5d0bca6a045028976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Fri, 3 Jan 2014 14:29:09 +0100 Subject: [PATCH] Workaround for a strange bug with Octave. If there is any call to exist(fname) before the call to the preprocessor, then Octave will use the old copy of the .m instead of the newly generated one. Deleting the .m beforehand fixes the problem. --- matlab/dynare.m | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/matlab/dynare.m b/matlab/dynare.m index 27a1fe742..034ec0674 100644 --- a/matlab/dynare.m +++ b/matlab/dynare.m @@ -96,6 +96,14 @@ else end; end; +% Workaround for a strange bug with Octave: if there is any call to exist(fname) +% before the call to the preprocessor, then Octave will use the old copy of +% the .m instead of the newly generated one. Deleting the .m beforehand +% fixes the problem. +if isoctave && length(dir([fname(1:(end-4)) '.m'])) > 0 + delete([fname(1:(end-4)) '.m']) +end + if ~isempty(strfind(fname,filesep)) fprintf('\nIt seems you are trying to call a mod-file not located in the "Current Folder". This is not possible (the %s symbol is not allowed in the name of the mod file).\n', filesep) [pathtomodfile,basename,ext] = fileparts(fname);