From 4202b7b77efd26d4009fad31b05c5749818ad32d Mon Sep 17 00:00:00 2001
From: Yngve Levinsen <yngve.levinsen@ess.eu>
Date: Wed, 16 Sep 2020 11:35:44 +0200
Subject: [PATCH] tracewin_errorstudy had outdated setup_exec_folder()

---
 scripts/tracewin_errorstudy | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/scripts/tracewin_errorstudy b/scripts/tracewin_errorstudy
index 01216fd..e2e7616 100755
--- a/scripts/tracewin_errorstudy
+++ b/scripts/tracewin_errorstudy
@@ -25,19 +25,19 @@ def setup_exec_folder():
     import os
     import shutil
 
-    orig_path = os.path.join(os.environ.get("HOME"), "TraceWin/exe")
+    orig_path = os.path.join(os.environ.get("HOME"), "TraceWin", "exe")
     if not os.path.isdir(orig_path):
         raise ValueError("Cannot find tracewin executables in " + orig_path + " yet")
-    os.makedirs("TraceWin/exe")
 
     o = dict(LINUX="lx", OSX="mac")
     a = dict(INTEL="", X86_64="64")
 
     for OpSys in ["LINUX", "OSX"]:
         for Arch in ["INTEL", "X86_64"]:
-            shutil.copy(
-                os.path.join(orig_path, "trace" + o[OpSys] + a[Arch]), os.path.join("TraceWin/exe", "tracewin.%s.%s" % (OpSys, Arch))
-            )
+            new_path = os.path.join(orig_path, f"tracewin.{OpSys}.{Arch}")
+            if os.path.isfile(new_path):
+                os.remove(new_path)
+            shutil.copy(os.path.join(orig_path, f"trace{o[OpSys]}{a[Arch]}"), new_path)
 
 
 def create_and_copy_lattice(args, calc_dir, commented=[], extra_line=""):
@@ -162,8 +162,7 @@ def setup_multi(args):
                     extra_line="ERROR_DYN_FILE Error_Datas.txt",
                 )
 
-    if not os.path.isdir("TraceWin/exe"):
-        setup_exec_folder()
+    setup_exec_folder()
 
     # Get random seeds from previously run jobs:
     seeds = []
@@ -238,8 +237,7 @@ def setup(args):
 
     create_and_copy_lattice(args, args.calc_dir)
 
-    if not os.path.isdir("TraceWin/exe"):
-        setup_exec_folder()
+    setup_exec_folder()
 
     if args.seed is not None:
         random.seed(args.seed)
-- 
GitLab