generated from saru/archived-lobotomy-modpack
somewhat working draft of installer.py
and readme.md
update
This commit is contained in:
parent
cf2f747945
commit
c771ceda63
@ -1,6 +1,6 @@
|
||||
# Lobotomy Land Mods, Installer, and Documentation
|
||||
## ****
|
||||

|
||||
# WEBFISHING Mods, Installer, and Documentation
|
||||
## *The Gay Fishing Game™ Must Be Modded.*
|
||||

|
||||
|
||||
# Description
|
||||
This repository contains a mod installer/syncing script that adds stuff to the Silly Gay Fishing Game.™
|
||||
|
69
installer.py
69
installer.py
@ -25,21 +25,36 @@ from pathlib import Path
|
||||
|
||||
# -----------define some functions ahead of time------------
|
||||
|
||||
|
||||
def delete_directory(directory_to_delete):
|
||||
# idea! consolidate both delete things and add an extra optino to the functions that toggles-
|
||||
# -error outputs using an if statement in the function's code `if quiet = true then... else...`
|
||||
def delete_directory_warn(directory_to_delete):
|
||||
#this defines a function to delete a directory (no shit)
|
||||
try:
|
||||
shutil.rmtree(str(directory_to_delete))
|
||||
except OSError as e:
|
||||
print("[ERR!]: %s - %s." % (e.filename, e.strerror))
|
||||
|
||||
def delete_file(file_to_delete):
|
||||
def delete_file_warn(file_to_delete):
|
||||
#this defines a function to delete a directory (no shit)
|
||||
try:
|
||||
os.remove(str(file_to_delete))
|
||||
except OSError as e:
|
||||
print("[ERR!]: %s - %s." % (e.filename, e.strerror))
|
||||
|
||||
def delete_directory(directory_to_delete):
|
||||
#this defines a function to delete a directory (no shit)
|
||||
try:
|
||||
shutil.rmtree(str(directory_to_delete))
|
||||
except:
|
||||
pass
|
||||
|
||||
def delete_file(file_to_delete):
|
||||
#this defines a function to delete a directory (no shit)
|
||||
try:
|
||||
os.remove(str(file_to_delete))
|
||||
except:
|
||||
pass
|
||||
|
||||
def extract_tar(tar_file_path, extract_to):
|
||||
#this defines a function to decompress a tar.gz file
|
||||
with tarfile.open(tar_file_path, 'r') as tar:
|
||||
@ -114,38 +129,58 @@ def compress_tar(folder_path, output_file):
|
||||
# --------------------the real shit!------------------------
|
||||
|
||||
|
||||
#`global` sets these variables to exist outside of the scope of these specific `if` statements.
|
||||
global gamedir
|
||||
global modfolder #`global` sets these variables to exist outside of the scope of these specific `if` statements.
|
||||
global homedir
|
||||
global savedir
|
||||
#can i group these together?
|
||||
#do i still need these to be global vars?
|
||||
|
||||
homedir = os.path.expanduser("~")
|
||||
os.chdir(homedir) #this cd's to the home folder
|
||||
|
||||
# vv REPLACE THIS! vv
|
||||
# This only really needs to be a backup of the game save, the mods are pretty whatevs.
|
||||
# really, if anything breaks and people want it fixed, theyll just come to me, so there's no point in giving them a backup.
|
||||
os.chdir(homedir)
|
||||
|
||||
#need to figure out what can happen here outside of `if` statements because this is painful to look at
|
||||
if platform.system() == "Linux":
|
||||
time.sleep(1)
|
||||
print("Operating system detected: GNU/Linux")
|
||||
|
||||
time.sleep(1) # import time
|
||||
print("Backing up save files...")
|
||||
print()
|
||||
print("Don't close the window! This'll take a moment...")
|
||||
|
||||
# here we cd to the save folder and save that path as a variable
|
||||
os.chdir(".steam/steam/steamapps/compatdata/3146520/pfx/drive_c/users/steamuser/AppData/Roaming/Godot/app_userdata/webfishing_2_newver/")
|
||||
savedir = Path.cwd()
|
||||
os.chdir(homedir)
|
||||
|
||||
#in this block we cd to savedir and then zip the old save file
|
||||
os.chdir(savedir)
|
||||
os.chdir('..') #go up one folder
|
||||
compress_tar("webfishing_2_newver", "webfishing-save-backup.tar.gz")
|
||||
|
||||
os.chdir(".steam/steam/steamapps/compatdata/3146520/pfx/drive_c/users/steamuser/AppData/Roaming/Godot/app_userdata/webfishing_2_newver/")
|
||||
savedir = Path.cwd()#environ var with path to save files
|
||||
os.chdir(homedir)#cd back to home folder
|
||||
|
||||
os.chdir(".local/share/Steam/steamapps/common/WEBFISHING/") #cd to game files
|
||||
gamedir = Path.cwd() #set environment variable with path to game files
|
||||
print("Changed current working directory to '" + str(gamedir) + "'")
|
||||
# here we cd to the game files and
|
||||
os.chdir(homedir)
|
||||
os.chdir(".local/share/Steam/steamapps/common/WEBFISHING/")
|
||||
gamedir = Path.cwd()
|
||||
print("[INFO] Changed current working directory to '" + str(gamedir) + "'")
|
||||
|
||||
# try deleting existing mods
|
||||
print("Cleaning game install...")
|
||||
delete_directory("GDWeave") #delete mods if they already exist
|
||||
delete_file("winmm.dll") #this probably doesn't actually need to be removed before updating but for now we're doing it
|
||||
|
||||
mod_url = 'https://git.adolin.xyz/saru/webfishing-sync-tool/raw/branch/main/image.ico'
|
||||
print("Fetching mod pack... This may take a few moments.")
|
||||
wget.download(url=mod_url)
|
||||
try:
|
||||
wget.download(url=mod_url)
|
||||
except:
|
||||
print()
|
||||
print("[ERR!] FATAL: Couldn't fetch new mods from the git repository. (is Adolin online?)")
|
||||
time.sleep(2) # import time
|
||||
print("[ERR!] Exiting...")
|
||||
time.sleep(2) # import time
|
||||
exit
|
||||
|
||||
elif platform.system() == "Windows":
|
||||
print("Operating system detected: Microsoft Windows")
|
||||
|
Loading…
x
Reference in New Issue
Block a user