From b7e9d698740852486d0b353018d6c4e8e5d94de2 Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Wed, 27 Dec 2023 14:51:02 +0100
Subject: [PATCH] dynare.m: remove redundant legacy check for file ending

---
 matlab/dynare.m | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/matlab/dynare.m b/matlab/dynare.m
index 2308ad8e33..fae2623200 100644
--- a/matlab/dynare.m
+++ b/matlab/dynare.m
@@ -297,17 +297,13 @@ if status
     error('Dynare: preprocessing failed')
 end
 
-if ~ isempty(find(abs(fname) == 46))
-    fname = fname(:,1:find(abs(fname) == 46)-1) ;
-end
-
 % We need to clear the driver (and only the driver, because the "clear all"
 % within the driver will clean the rest)
-clear(['+' fname '/driver'])
+clear(['+' fname(1:end-4) '/driver'])
 
 try
     cTic = tic;
-    evalin('base',[fname '.driver']);
+    evalin('base',[fname(1:end-4) '.driver']);
     cToc = toc(cTic);
     if nargout
         DynareInfo.time.compute = cToc;
@@ -315,7 +311,7 @@ try
 catch ME
     W = evalin('caller','whos');
     diary off
-    if ismember(fname,{W(:).name})
+    if ismember(fname(1:end-4),{W(:).name})
         error('Your workspace already contains a variable with the same name as the mod-file. You need to delete it or rename the mod-file.')
     else
         rethrow(ME)
-- 
GitLab