diff --git a/dislocker_client_shutdown.py b/dislocker_client_shutdown.py index b7e5419..91428ac 100644 --- a/dislocker_client_shutdown.py +++ b/dislocker_client_shutdown.py @@ -106,17 +106,6 @@ class App(tkinter.Tk): def handler_close(self): print("停止処理を実行。") - if client_config["eraser"] == True: - appdata_local = os.path.expandvars("%LOCALAPPDATA%") - appdata_roaming = os.path.expandvars("%APPDATA%") - epic_del = self.delete_appdata(process_name="EpicGamesLauncher.exe", dir_path=f"{appdata_local}\\EpicGamesLauncher\\Saved") - chrome_del = self.delete_appdata(process_name="chrome.exe", dir_path=f"{appdata_local}\\Google\\Chrome\\User Data") - discord_del = self.delete_appdata(process_name="discord.exe", dir_path=f"{appdata_roaming}\\discord") - steam_del = self.delete_appdata(process_name="steam.exe", dir_path=f"{appdata_local}\\Steam") - ea_del = self.delete_appdata(process_name="EADesktop.exe", dir_path=f"{appdata_local}\\Electronic Arts") - riot_del = self.delete_appdata(process_name="RiotClientServices.exe", dir_path=f"{appdata_local}\\Riot Games\\Riot Client") - else: - print("削除処理をスキップ。") stop_url = client_config["auth_host_url"] + "/stop" stop_json = { "pc_number": int(client_config["pc_number"]), @@ -133,8 +122,24 @@ class App(tkinter.Tk): print("内部エラーにより停止処理に失敗しました。") except: print("ネットワークエラーにより停止処理に失敗しました。") - finally: - self.destroy() + + print("データ削除を実行。") + try: + if client_config["eraser"] == True: + appdata_local = os.path.expandvars("%LOCALAPPDATA%") + appdata_roaming = os.path.expandvars("%APPDATA%") + epic_del = self.delete_appdata(process_name="EpicGamesLauncher.exe", dir_path=f"{appdata_local}\\EpicGamesLauncher\\Saved") + chrome_del = self.delete_appdata(process_name="chrome.exe", dir_path=f"{appdata_local}\\Google\\Chrome\\User Data") + discord_del = self.delete_appdata(process_name="discord.exe", dir_path=f"{appdata_roaming}\\discord") + steam_del = self.delete_appdata(process_name="steam.exe", dir_path=f"{appdata_local}\\Steam") + ea_del = self.delete_appdata(process_name="EADesktop.exe", dir_path=f"{appdata_local}\\Electronic Arts") + riot_del = self.delete_appdata(process_name="RiotClientServices.exe", dir_path=f"{appdata_local}\\Riot Games\\Riot Client") + else: + print("削除処理をスキップ。") + except: + print("データ削除に失敗しました。") + + self.destroy() def icon(self): self.iconify()