Created
September 20, 2023 21:00
-
-
Save Coolsonickirby/b220a1fb501b87f2c5874f114e0c2410 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ============================================================ | |
# Written by Coolsonickirby | |
# Use Python 3.9 or higher | |
# | |
# You shouldn't need to install any modules for this script | |
# You do however need to have curl downloaded and added to PATH | |
# | |
# You also need sys-ftpd(-light) set up on your switch (even for normal `cargo skyline run`) | |
# | |
# Usage: python cargo-skyline-run.py | |
# (Make sure you're in the project folder (the one with Cargo.toml) before running the script) | |
# | |
# I recommend adding this script to the PATH environment variable so that you can easily run it in any project folder | |
# ============================================================ | |
import os | |
def get_key_value(text, key): | |
line_idx = cargo_toml.find(key) | |
start_idx = cargo_toml.find("\"", line_idx) + 1 | |
end_idx = cargo_toml.find("\"", start_idx) | |
return text[start_idx:end_idx] | |
os.system("cargo skyline build --release") | |
cargo_toml = open("Cargo.toml").read() | |
title_id = get_key_value(cargo_toml, "titleid") | |
plugin_name = "" | |
source = "" | |
for x in os.listdir("target/aarch64-skyline-switch/release"): | |
if x.endswith(".nro"): | |
plugin_name = x | |
source = "./target/aarch64-skyline-switch/release/%s" % plugin_name | |
break | |
if source == "": | |
print("No valid plugin found!") | |
exit() | |
switch_ip = open(os.path.join(os.environ["USERPROFILE"], ".switch", "ip_addr.txt")).read() | |
os.system("curl -T %s ftp://%s:5000/atmosphere/contents/%s/romfs/skyline/plugins/%s" % (source, switch_ip, title_id, plugin_name)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment