FIx compatibility with Windows 10, compiles to .exe

This commit is contained in:
Obie Hinojosa 2024-10-29 02:04:44 -07:00
parent 1e2e035310
commit d86a842917

View File

@ -15,36 +15,39 @@ homedir = os.path.expanduser("~")
#we find the minecraft folder in this section. #we find the minecraft folder in this section.
if platform.system() == "Linux": if platform.system() == "Linux":
print("Operating system detected: Linux") print("Operating system detected: Linux")
global mcfolder
elif platform.system() == "Windows": global modfolder
print("Operating system detected: Windows")
elif platform.system() == "Darwin":
print("Operating system detected: MacOS")
print("fuck you.")
#needs function
os.chdir(homedir + '/.minecraft') os.chdir(homedir + '/.minecraft')
mcfolder = Path.cwd() mcfolder = Path.cwd()
modfolder = homedir + '/.minecraft/mods' modfolder = homedir + '/.minecraft/mods'
os.chdir(mcfolder) os.chdir(mcfolder)
print("Changed current working directory to '" + str(mcfolder) + "'") print("Changed current working directory to '" + str(mcfolder) + "'")
time.sleep(2) time.sleep(2)
elif platform.system() == "Windows":
print("Operating system detected: Windows")
os.chdir(homedir)
os.chdir("AppData")
os.chdir("Roaming")
os.chdir(".minecraft")
mcfolder = Path.cwd()
os.chdir("mods")
modfolder = Path.cwd
os.chdir(mcfolder)
print("Changed current working directory to '" + str(mcfolder) + "'")
time.sleep(2)
os.chdir(mcfolder)
#begin mod backup and deletion #begin mod backup and deletion
#THIS DOESN'T CURRENTLY BACK UP EXISTING MODS. #THIS DOESN'T CURRENTLY BACK UP EXISTING MODS.
try: try:
shutil.rmtree(modfolder) shutil.rmtree(str("mods"))
print("Cleared previous mods.") print("Cleared previous mods.")
except OSError as e: except OSError as e:
print("Error: %s - %s." % (e.filename, e.strerror)) print("Error: %s - %s." % (e.filename, e.strerror))
os.mkdir(modfolder) os.mkdir(str("mods"))