Skip to content

Commit 9aa3f05

Browse files
committed
'./configure' now checks if 'config.toml' exists before writing to that destination
1 parent 39bf777 commit 9aa3f05

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/bootstrap/configure.py

+6
Original file line numberDiff line numberDiff line change
@@ -521,13 +521,19 @@ def write_config_toml(writer, section_order, targets, sections):
521521
else:
522522
writer = write_uncommented(sections[section], writer)
523523

524+
def quit_if_file_exists(file):
525+
if os.path.isfile(file):
526+
p("Existing '" + file + "' detected. EXITING")
527+
quit()
524528

525529
if __name__ == "__main__":
526530
p("processing command line")
527531
# Parse all known arguments into a configuration structure that reflects the
528532
# TOML we're going to write out
529533
p("")
530534
section_order, sections, targets = parse_args(sys.argv[1:])
535+
# If 'config.toml' already exists, exit the script at this point
536+
quit_if_file_exists('config.toml')
531537

532538
# Now that we've built up our `config.toml`, write it all out in the same
533539
# order that we read it in.

0 commit comments

Comments
 (0)