add building blocks for 3rd party launcher support

This commit is contained in:
Obie Hinojosa 2025-05-28 19:23:43 -05:00
parent e337495d1c
commit 7ce1216f71

View File

@ -1,7 +1,7 @@
# -----------------------read me?---------------------------
# compiling this is super easy, just run `pip install wget` and `pip install pyinstaller` and then
# compiling this is super easy, just run `pip install wget pyinstaller certifi` and then
# compile with `python -m PyInstaller --onefile installer.py --icon image.ico`
# (wget is a dependency for this python script that doesnt come with python by default)
@ -9,9 +9,6 @@
# also, peep the organized code blocks!! am i cool or what?
# something worthy of note: this code desperately needs to be refactored. right now literally
# everything important happens under a big if elif statement and its pretty fucking stupid
# -----------------import dependencies----------------------
@ -110,11 +107,21 @@ def print_ascii_art():
print(" ....")
print()
def checkfor_and_delete_file(filepath):
def check_if_exists_and_delete_file(filepath):
#deletes old downloaded mod archives
if os.path.exists(filepath):
print("Found previously downloaded archive, deleting...")
os.remove(filepath)
else:
pass
def check_for_launcher_files(filepath, launchername):
#checks for evidence of 3rd party launchers and sets a variable flag if a launcher is installed
if os.path.exists(filepath):
print("Alternative Minecraft launcher detected: " + str(launchername))
detectedlauncher = str(launchername)
else:
pass
# --------------------the real shit!------------------------
@ -131,6 +138,9 @@ global modfolder
if platform.system() == "Linux":
print("Operating system detected: Linux")
check_for_launcher_files(str(Path.cwd()) + "/.var/app/org.prismlauncher.Prism.Launcher", "PrismLauncherFlatpak")
check_for_launcher_files(str(Path.cwd()) + "/.local/share/PrismLauncher/prismlauncher.cfg", "PrismLauncherPackage")
os.chdir(".minecraft")
mcfolder = str(Path.cwd())
modfolder = mcfolder + '/mods'