[FIX] todo upgrade: copying database when missing

This commit is contained in:
Mathieu Benoit 2026-01-05 07:52:30 -05:00
parent 8f297f148d
commit 9769bc83b5

View file

@ -731,15 +731,24 @@ class TodoUpgrade:
if not self.dct_progression.get("state_1_restore_database"): if not self.dct_progression.get("state_1_restore_database"):
file_name = os.path.basename(self.file_path) file_name = os.path.basename(self.file_path)
image_db_file_path = os.path.join("image_db", file_name) image_db_file_path = os.path.join("image_db", file_name)
if os.path.exists(image_db_file_path): str_will_copy = (
if not shutil._samefile(self.file_path, image_db_file_path): f"🤖 will copy '{self.file_path}' to '{image_db_file_path}'"
)
if not shutil._samefile(self.file_path, image_db_file_path):
do_copy = False
if os.path.exists(image_db_file_path):
status_overwrite_image_db = input( status_overwrite_image_db = input(
f"🤖 will copy '{self.file_path}' to '{image_db_file_path}', " f"{str_will_copy}, "
f"a file already exist, do you want to continue (y/Y) : " f"a file already exist, do you want to continue (y/Y) : "
).strip() ).strip()
if status_overwrite_image_db.lower() != "y": if status_overwrite_image_db.lower() == "y":
return do_copy = True
os.remove(image_db_file_path) os.remove(image_db_file_path)
else:
print(str_will_copy)
do_copy = True
if do_copy:
shutil.copy(self.file_path, image_db_file_path) shutil.copy(self.file_path, image_db_file_path)
status, cmd_executed = self.todo_upgrade_execute( status, cmd_executed = self.todo_upgrade_execute(