From f5bce79a0dee9cddc50bc550476f0ec5679e13d0 Mon Sep 17 00:00:00 2001
From: Antoine Merle <antoine.merle@epfl.ch>
Date: Thu, 12 Aug 2021 13:42:04 +0000
Subject: [PATCH] Only add path if necessary

---
 matlab/JET/rda_jet.m | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/matlab/JET/rda_jet.m b/matlab/JET/rda_jet.m
index 3517b6f6..1d93ae69 100644
--- a/matlab/JET/rda_jet.m
+++ b/matlab/JET/rda_jet.m
@@ -34,8 +34,9 @@ end
 if usemdsplus
   % use mdsplus
 
-  if exist('/home/amerle/codes/mds-ssh','dir')
-    addpath('/home/amerle/codes/mds-ssh')
+  mds_dir = '/home/amerle/codes/mds-ssh';
+  if exist(mds_dir,'dir') && ~strcmp(which('mdsipmex'),fullfile(mds_dir,'mdsipmex.mexa64'))
+    addpath(mds_dir);
   end
   mdsconnect(['ssh://' jet_user '@mdsplus.jetdata.eu']);
   mdsvalue('reset_public()');
-- 
GitLab