Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update launcher.pyw #32

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions create-exe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# Install dependencies
python3 -m venv venv
source venv/bin/activate
pip install -r pipinstaller
pyinstaller --onefile --add-data "assets;assets" --icon=assets/icon.icns --clean launcher.pyw
pip install pyinstaller
pyinstaller --onefile --add-data="assets:assets" --icon=assets/icon.icns --clean launcher.pyw

# Prompt for continuation
read -rsp "Finished. Press any key to continue." -n1 key
echo
echo
9 changes: 7 additions & 2 deletions launcher.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def asspat(): #assets path since i keep asking "Wtf is asspat?" only to remember
if sysenv == 1:
ass_pat = os.path.join(sys._MEIPASS, "assets")#asspat windows
elif sysenv == 2 or sysenv == 3:
ass_pat = os.path.join(sys._MEIPASSBASE, "assets")#asspat mac+linux
ass_pat = os.path.join(sys._MEIPASS, "assets")#asspat mac+linux
elif os.path.exists(os.path.join(".", "assets")):
ass_pat = os.path.join(".", "assets")#asspat script
else:
Expand Down Expand Up @@ -1422,6 +1422,8 @@ def build_game(return_values):

if not os.path.exists(os.path.join(smw_dir, ".git")):
git_clone("https://github.com/snesrev/smw.git", os.path.join(smw_dir))
for file_name in ["smw.sfc"]:
shutil.copy2(os.path.join(install_dir, file_name), os.path.join(smw_dir, file_name))
for file_name in ["smb1.zst", "smbll.zst"]: #user provides their own smas.sfc and smw.sfc files.
shutil.copy2(os.path.join(smw_dir, "other", file_name), os.path.join(install_dir, file_name))

Expand Down Expand Up @@ -1454,6 +1456,9 @@ def build_game(return_values):
for file_name in ["smas.sfc"]:
if os.path.exists(os.path.join(install_dir, file_name)):
shutil.move(os.path.join(install_dir, file_name),os.path.join(launcher_dir, file_name))
for file_name in ["smw_assets.dat"]:
if os.path.exists(os.path.join(smw_dir, file_name)):
shutil.move(os.path.join(smw_dir, file_name),os.path.join(install_dir, file_name))
except Exception as e:
# Handle exceptions and log the error
error_message = f"!!!!!!!!!!!!!!!!!!!!!!!!!vvvvvvvvvv!!!!!!!!!!!!!!!!!!!!!!!!!\nAn error occurred in thread \"build_thread\": \n{str(e)}\n!!!!!!!!!!!!!!!!!!!!!!!!!^^^^^^^^^^!!!!!!!!!!!!!!!!!!!!!!!!!"
Expand Down Expand Up @@ -2083,7 +2088,7 @@ def main():
sys.stdout = sys.__stdout__
sys.stderr = sys.__stderr__
tee_logger.close() # Close the log file
quit()
sys.exit(1)

if __name__ == "__main__":
main()