From a917d5e99802032e6926b9905d2d0309227b0bd6 Mon Sep 17 00:00:00 2001 From: Houtan Bastani <houtan@dynare.org> Date: Mon, 17 Aug 2015 12:29:59 +0200 Subject: [PATCH] only add path to LOAD_PATH if it is not already there --- julia/Dynare.jl | 6 ++++-- tests/julia/rbc/test.jl | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/julia/Dynare.jl b/julia/Dynare.jl index 4f9be3cedf..3e8e7704aa 100644 --- a/julia/Dynare.jl +++ b/julia/Dynare.jl @@ -21,8 +21,10 @@ module Dynare export dynare, @dynare function dynare(modfile) - # Add cd to path - unshift!(LOAD_PATH, pwd()) + # Add cd to path if not already there + if isempty(findin([pwd()], LOAD_PATH)) + unshift!(LOAD_PATH, pwd()) + end # Process modfile println(string("Using ", WORD_SIZE, "-bit preprocessor")) diff --git a/tests/julia/rbc/test.jl b/tests/julia/rbc/test.jl index 79ccd4d5ab..339e6f44d4 100644 --- a/tests/julia/rbc/test.jl +++ b/tests/julia/rbc/test.jl @@ -2,7 +2,9 @@ workspace() # Modification of the path (for packages). Should be done in ~/.juliarc.jl with a fixed path instead. -unshift!(LOAD_PATH, abspath("../../../julia")) +if isempty(findin([abspath("../../../julia")], LOAD_PATH)) + unshift!(LOAD_PATH, abspath("../../../julia")) +end # Load Dynare package importall Dynare -- GitLab