Skip to content

Commit a3c1c08

Browse files
committed
Clean up existing entry-point folder existance logic
Previously if you kept running prepare scan without rebuilding the folders would slowly stack up with (#) on the end. This avoids that by only checking for name duplications within the actual results.
1 parent eaf7f22 commit a3c1c08

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

driver/mkbench.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ def collect_java_binaries(cmdline):
169169
java_binaries.classpath_jar_files +
170170
java_libraries.classpath_jar_files +
171171
library_directories)
172+
173+
previously_created_folders = set()
172174
for ep_data in ep_config["entryPoints"]:
173175

174176
method_data = ep_data["method"]
@@ -183,11 +185,15 @@ def collect_java_binaries(cmdline):
183185

184186
# If our folder exists then just add (#number) to it and try creation again.
185187
incrementor = 1
186-
while os.path.exists(output_folder):
188+
while output_folder in previously_created_folders:
187189
folder_name = friendly_method_name.replace(os.path.sep, '.') + " (" + str(incrementor) + ")"
188190
output_folder = os.path.join(cmdline.results_dir, folder_name)
189191
incrementor += 1
190192

193+
previously_created_folders.add(output_folder)
194+
if os.path.exists(output_folder) and os.path.isdir(output_folder):
195+
shutil.rmtree(output_folder)
196+
191197
os.mkdir(output_folder)
192198

193199
generated_temp_folder = os.path.join(cmdline.temp_dir, folder_name)

0 commit comments

Comments
 (0)