-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharghelper.py
More file actions
executable file
·39 lines (31 loc) · 1.07 KB
/
arghelper.py
File metadata and controls
executable file
·39 lines (31 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import sys
import os
from pathlib import Path
systems = ['MAME', 'NES', 'SNES', 'GB', 'GBC', 'N64', 'PCE', 'MD']
# Sets the path to ROM-files based on the user given CLI argument. If that's not given, uses the current working directory
def get_rompath() -> Path:
if len(sys.argv) > 2:
print("Too many arguments.")
sys.exit()
if len(sys.argv) < 2:
rompath = Path.cwd()
else:
rompath = sys.argv[1]
rompath = Path(rompath)
if(os.path.exists(rompath)):
return rompath
else:
print("The path specified doesn't exist!")
sys.exit()
# Sets the name of the list file based on user selection
def get_gameslist() -> Path:
answer = input(f"Which platform? {systems} ").upper()
while(answer not in systems):
print(f"You didn't pick a correct platform! Choose from {systems}")
answer = input("Which platform? ").upper()
gamefile = Path(f"{answer}gameslist.txt")
return gamefile
def main():
print("This file is not meant to be run on its own.")
if __name__ == '__main__':
main()