From 162ca815bc78d81c8e6e3d00570a2582508ebe63 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Fri, 15 Dec 2023 15:39:36 +0100
Subject: [PATCH] Replace calls to isdir by isfolder
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

isfolder is the modern replacement to isdir, and is available in MATLAB ⩾
R2017b and in Octave ⩾ 7.

Detected and automatically fixed by MATLAB Code Analyzer app.
---
 matlab/+bvar/forecast.m | 4 ++--
 matlab/+bvar/irf.m      | 4 ++--
 matlab/CheckPath.m      | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/matlab/+bvar/forecast.m b/matlab/+bvar/forecast.m
index 2ca24f4ddb..6fb0d2ca9d 100644
--- a/matlab/+bvar/forecast.m
+++ b/matlab/+bvar/forecast.m
@@ -154,8 +154,8 @@ end
 % Store results
 
 DirectoryName = [ M_.dname '/bvar_forecast' ];
-if ~isdir(DirectoryName)
-    if ~isdir(M_.dname)
+if ~isfolder(DirectoryName)
+    if ~isfolder(M_.dname)
         mkdir(M_.dname);
     end
     mkdir(DirectoryName);
diff --git a/matlab/+bvar/irf.m b/matlab/+bvar/irf.m
index 3889989059..69074e2cce 100644
--- a/matlab/+bvar/irf.m
+++ b/matlab/+bvar/irf.m
@@ -130,7 +130,7 @@ end
 
 % Save intermediate results
 DirectoryName = [ M_.dname '/bvar_irf' ];
-if ~isdir(DirectoryName)
+if ~isfolder(DirectoryName)
     mkdir('.',DirectoryName);
 end
 save([ DirectoryName '/simulations.mat'], 'sampled_irfs');
@@ -146,4 +146,4 @@ for i=1:ny
         oo_.bvar.irf.Upper_bound.(variable_name).(shock_name) = posterior_up_conf_irfs(j,i,:);
         oo_.bvar.irf.Lower_bound.(variable_name).(shock_name) = posterior_down_conf_irfs(j,i,:);
     end
-end
\ No newline at end of file
+end
diff --git a/matlab/CheckPath.m b/matlab/CheckPath.m
index 6f27753c48..d7e85b4c17 100644
--- a/matlab/CheckPath.m
+++ b/matlab/CheckPath.m
@@ -33,7 +33,7 @@ info = 0;
 
 DirectoryName = [ dname '/' type ]; % don't use filesep as it will create issues with LaTeX on Windows
 
-if ~isdir(dname)
+if ~isfolder(dname)
     % Make sure there isn't a file with the same name, see trac ticket #47
     if isfile(dname)
         delete(dname)
@@ -41,7 +41,7 @@ if ~isdir(dname)
     mkdir('.', dname);
 end
 
-if ~isdir(DirectoryName)
+if ~isfolder(DirectoryName)
     % Make sure there isn't a file with the same name, see trac ticket #47
     if isfile(DirectoryName)
         delete(DirectoryName)
-- 
GitLab