Skip to content

Commit

Permalink
added dialogue on uninstall to ask to keep plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
amydevs committed Aug 9, 2021
1 parent bfc4515 commit cd834af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions modules/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ def install(self, bepinUrl:str, installUnityLibs:bool):

print('Done!\nYou Can Now Put Your Mods in "{}"'.format(os.path.join(bepinPath, "plugins")))

def uninstall(self, deletePlugins:bool = False):
def uninstall(self, preservePlugins:bool = True):
print("Uninstalling...")

if (os.path.exists(os.path.join(self.gameDirectory, "MelonLoader"))):
print("MelonLoader was detected in your game folder. If you'd like for this to be deleted, this will be done in 10 seconds. If not, PLEASE CLOSE THIS APPLICATION NOW!")
time.sleep(10)
self.deleteFiles(["MelonLoader", "Plugins", "Mods", "Logs", "version.dll"])
elif (deletePlugins):
elif (not preservePlugins):
self.deleteFiles(["BepInEx", "mono", "changelog.txt", "doorstop_config.ini", "winhttp.dll"])
elif (not deletePlugins):
elif (preservePlugins):
willDelList = ["mono", "changelog.txt", "doorstop_config.ini", "winhttp.dll"]
for fileOrFolder in glob.glob(os.path.join(self.gameDirectory, "BepInEx", "*")):
fileBName = os.path.basename(fileOrFolder)
Expand Down
6 changes: 3 additions & 3 deletions srxdbepinexinstallerui.pyw
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from tkinter import *
import tkinter
from tkinter import messagebox
from tkinter.filedialog import askdirectory
from tkinter import ttk

Expand Down Expand Up @@ -118,7 +118,8 @@ class GUIWindow:
installUnityLibs = False
installthread = threading.Thread(target=installerInstance.install, args=(downloadUrl, installUnityLibs), daemon=True).start()
elif (isUninstall):
installthread = threading.Thread(target=installerInstance.uninstall, daemon=True).start()
preservePlugins = bool(messagebox.askyesno('Preserve Backup Files', 'Would you still like to keep the "plugins" and "config" folders inside "BepInEx"?'))
installthread = threading.Thread(target=installerInstance.uninstall, args=(preservePlugins, ), daemon=True).start()
else:
print("Installer may not have initialised properly yet.")
else:
Expand All @@ -131,7 +132,6 @@ try:
window.geometry("520x405")
window.mainloop()
except Exception as e:
from tkinter import messagebox
messagebox.Message().show(title=e, message=e)


Expand Down

0 comments on commit cd834af

Please sign in to comment.