Skip to content

Commit 7f83ce0

Browse files
committed
Improve output folder handling by prompting user confirmation before overwriting
1 parent cda085f commit 7f83ce0

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/deep_image_matching/config.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import json
33
import logging
44
import shutil
5+
import sys
56
from copy import deepcopy
67
from enum import Enum
78
from pathlib import Path
@@ -469,9 +470,13 @@ def parse_general_config(input_args: dict) -> dict:
469470
shutil.rmtree(args["outs"])
470471
else:
471472
logger.warning(
472-
f"{args['outs']} already exists. Use '--force' option to overwrite the folder. Using existing features is not yet fully implemented (it will be implemented in a future release). Exiting."
473+
"Output folder already exists. Results will be overwritten (reusing existing features is not yet implemented). Do you want to continue anyway? (yes/no)"
473474
)
474-
exit(1)
475+
if input("Type 'yes' to continue: ").lower() != "yes":
476+
logger.error(
477+
"Exiting. Please use '--force' option to overwrite the existing folder."
478+
)
479+
sys.exit(1)
475480
args["outs"].mkdir(parents=True, exist_ok=True)
476481

477482
# Check extraction and matching configuration

0 commit comments

Comments
 (0)