Skip to content

Commit

Permalink
update keys script
Browse files Browse the repository at this point in the history
  • Loading branch information
seiya-git committed Nov 10, 2023
1 parent d161399 commit 41c9a46
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions py/nstools/nut/Keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,15 @@ def load(fileName):
return keys_loaded

def load_default():
keyPyPath = Path(sys.argv[0])
while not keyPyPath.is_dir():
keyPyPath = keyPyPath.parents[0]
keyRootPath = Path(os.path.abspath(os.path.join(str(keyPyPath), '..')))
keyScriptPath = Path(sys.argv[0])
while not keyScriptPath.is_dir():
keyScriptPath = keyScriptPath.parents[0]

keyfiles = [
Path.home().joinpath(".switch", "prod.keys"),
Path.home().joinpath(".switch", "keys.txt"),
keyRootPath.joinpath("prod.keys"),
keyRootPath.joinpath("keys.txt"),
keyPyPath.joinpath("prod.keys"),
keyPyPath.joinpath("keys.txt"),
keyScriptPath.joinpath("prod.keys"),
keyScriptPath.joinpath("keys.txt"),
Path(os.environ.get("NSTOOLS_KEYS_FILE", "$NSTOOLS_KEYS_FILE")),
]

Expand All @@ -198,4 +195,4 @@ def load_default():
errorMsg += " not found\n\nPlease dump your keys using https://github.com/shchmue/Lockpick_RCM/releases\n"
errorMsg = "Failed to load default keys files:\n" + errorMsg
Print.error(errorMsg)
return keys_loaded
return keys_loaded

0 comments on commit 41c9a46

Please sign in to comment.