suffix change in rename_all_folders()

This commit is contained in:
faroukbmiled 2023-09-26 21:16:31 +01:00
parent 5373d06e72
commit 572070b18f

View File

@ -397,6 +397,7 @@ class SettingsTab(ctk.CTkFrame):
def settings_check_for_updates(self): def settings_check_for_updates(self):
check_for_updates_func(self, ignore_up_todate=False) check_for_updates_func(self, ignore_up_todate=False)
# make this rename to {id}_duplicate as a fallback
def rename_all_folders(self, option): def rename_all_folders(self, option):
boiiiFolder = main_app.app.edit_destination_folder.get() boiiiFolder = main_app.app.edit_destination_folder.get()
maps_folder = os.path.join(boiiiFolder, "mods") maps_folder = os.path.join(boiiiFolder, "mods")
@ -436,6 +437,9 @@ class SettingsTab(ctk.CTkFrame):
folder_to_rename = os.path.join(folder_path, folder_name) folder_to_rename = os.path.join(folder_path, folder_name)
new_folder_name = new_name new_folder_name = new_name
while new_folder_name in processed_names: while new_folder_name in processed_names:
if option == "PublisherID":
new_folder_name += f"_duplicated"
else:
new_folder_name += f"_{publisher_id}" new_folder_name += f"_{publisher_id}"
if folder_name == new_folder_name: if folder_name == new_folder_name:
rename_flag = False rename_flag = False
@ -443,6 +447,9 @@ class SettingsTab(ctk.CTkFrame):
new_path = os.path.join(folder_path, new_folder_name) new_path = os.path.join(folder_path, new_folder_name)
while os.path.exists(new_path): while os.path.exists(new_path):
if option == "PublishedID":
new_folder_name += f"_duplicated"
else:
new_folder_name += f"_{publisher_id}" new_folder_name += f"_{publisher_id}"
if folder_name == new_folder_name: if folder_name == new_folder_name:
rename_flag = False rename_flag = False