From 656e63e360d9fa979f932b601c46b1c1ea8aa1a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?= <stephane.adjemian@univ-lemans.fr> Date: Sat, 10 Feb 2018 10:27:44 +0100 Subject: [PATCH] Fixed behaviour in case of missing X13 binary... ... Also do not crash dynare_config() if matlab is not able to download the X13 binary. (cherry picked from commit 67d08340297265b8da1d059f851627d688a2df69) --- src/@x13/run.m | 10 +++++++++- src/initialize_dseries_toolbox.m | 9 +++++++-- src/utilities/x13/select_x13_binary.m | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/@x13/run.m b/src/@x13/run.m index 73faa7a..4692c3b 100644 --- a/src/@x13/run.m +++ b/src/@x13/run.m @@ -22,8 +22,16 @@ function run(o, basename) % Print spc file. basename = o.print(); +% Get expected path to X13 binary. +x13b = select_x13_binary(); + +% Test for the existence of the binary. +if ~exist(x13b, 'file') + error('X13 is not available, so we cannot run the generated spc file.') +end + % Run spc file. -[~, ~] = system(sprintf('%s %s', select_x13_binary(), basename)); +[~, ~] = system(sprintf('%s %s', x13b, basename)); o.results.name = basename; % Base name of the generated files. diff --git a/src/initialize_dseries_toolbox.m b/src/initialize_dseries_toolbox.m index 00e6b5b..a8cbe15 100644 --- a/src/initialize_dseries_toolbox.m +++ b/src/initialize_dseries_toolbox.m @@ -78,8 +78,13 @@ end % Install X13 binaries opath = pwd(); -cd([dseries_src_root '/../externals/x13']) -installx13(); +try + cd([dseries_src_root '/../externals/x13']) + installx13(); +catch + warning('X13 is not available!') + p(strmatch('/utilities/x13', p, 'exact')) = []; +end cd(opath); % Set path diff --git a/src/utilities/x13/select_x13_binary.m b/src/utilities/x13/select_x13_binary.m index f7c3873..0ade22f 100644 --- a/src/utilities/x13/select_x13_binary.m +++ b/src/utilities/x13/select_x13_binary.m @@ -40,5 +40,5 @@ elseif ispc() x13_binary = sprintf('%s%s%s%s', x13_binary, '32', filesep(), 'x13.exe'); end else - error('X13 binary is not yet available for this plateform') + error('X13 binary is not available for this plateform') end \ No newline at end of file -- GitLab