@@ -84,9 +84,22 @@ def dumpfile(name):
84
84
85
85
orig_cwd = os .getcwd ()
86
86
if args .output_dir :
87
- output_dir = os .path .realpath (args .output_dir )
87
+ # Si l'utilisateur a spécifié un dossier de sortie, on l'utilise mais en s'assurant qu'il est dans 4IF_PLD
88
+ user_output_dir = os .path .realpath (args .output_dir )
89
+ base_path = os .path .dirname (os .path .dirname (os .path .realpath (__file__ )))
90
+ pld_path = f"{ base_path } /4IF_PLD"
91
+
92
+ # Vérifier si le chemin spécifié est déjà dans 4IF_PLD
93
+ if pld_path in user_output_dir :
94
+ output_dir = user_output_dir
95
+ else :
96
+ # Sinon, utiliser le nom du dossier spécifié mais dans 4IF_PLD
97
+ output_dir = os .path .join (pld_path , os .path .basename (user_output_dir ))
98
+ print (f"Redirection du dossier de sortie vers 4IF_PLD: { output_dir } " )
88
99
else :
89
- output_dir = os .path .dirname (orig_cwd ) + "/ifcc-wat-test-output"
100
+ # Si aucun dossier n'est spécifié, créer le dossier par défaut dans 4IF_PLD
101
+ base_path = os .path .dirname (os .path .dirname (os .path .realpath (__file__ )))
102
+ output_dir = f"{ base_path } /4IF_PLD/ifcc-wat-test-output"
90
103
91
104
if "ifcc-wat-test-output" in orig_cwd :
92
105
print ('error: cannot run from within the output directory' )
@@ -98,8 +111,18 @@ def dumpfile(name):
98
111
os .makedirs (output_dir , exist_ok = True )
99
112
100
113
# Compilation du projet
101
- print (f"Compilation du projet : { os .path .dirname (orig_cwd )} /compiler" )
102
- make_command = f"cd { os .path .dirname (orig_cwd )} /compiler && make -j"
114
+ base_path = os .path .dirname (orig_cwd )
115
+ compiler_path = f"{ base_path } /compiler"
116
+ compiler_path_alt = f"{ base_path } /4IF_PLD/compiler"
117
+
118
+ # Vérifie si le chemin standard existe, sinon utilise le chemin alternatif
119
+ if not os .path .exists (compiler_path ):
120
+ compiler_path = compiler_path_alt
121
+ print (f"Chemin standard non trouvé, utilisation du chemin alternatif: { compiler_path } " )
122
+ else :
123
+ print (f"Compilation du projet : { compiler_path } " )
124
+
125
+ make_command = f"cd { compiler_path } && make -j"
103
126
print (f"Exécution de : { make_command } " )
104
127
makestatus = command (make_command , "make-compile.txt" )
105
128
if makestatus != 0 :
@@ -149,7 +172,15 @@ def dumpfile(name):
149
172
if args .compiler :
150
173
compiler = os .path .realpath (os .getcwd () + "/" + args .compiler )
151
174
else :
152
- compiler = os .path .dirname (os .path .dirname (os .path .realpath (__file__ ))) + "/4IF_PLD/compiler/ifcc"
175
+ base_path = os .path .dirname (os .path .dirname (os .path .realpath (__file__ )))
176
+ ifcc_path = base_path + "/compiler/ifcc"
177
+ ifcc_path_alt = base_path + "/4IF_PLD/compiler/ifcc"
178
+
179
+ # Vérifie si le chemin standard existe, sinon utilise le chemin alternatif
180
+ if os .path .isfile (ifcc_path ):
181
+ compiler = ifcc_path
182
+ else :
183
+ compiler = ifcc_path_alt
153
184
154
185
if not os .path .isfile (compiler ):
155
186
print ("error: cannot find ifcc compiler at: " + compiler )
0 commit comments