31 lines
669 B
Python
Executable File
31 lines
669 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
from sys import argv, exit
|
|
|
|
def usage():
|
|
print('%s SRC DST' % argv[0])
|
|
print(' reads uxn roms from SRC')
|
|
print(' generates an index at DST')
|
|
exit(1)
|
|
|
|
def main():
|
|
if len(argv[1:]) != 2:
|
|
return usage()
|
|
src, dst = argv[1:]
|
|
if not os.path.isdir(src):
|
|
print('%r is not a directory' % src)
|
|
return usage()
|
|
if os.path.exists(dst):
|
|
print('%r already exists' % dst)
|
|
return usage()
|
|
|
|
roms = []
|
|
for root, _, names in os.walk(src):
|
|
for name in names:
|
|
if not name.endswith('.rom'):
|
|
continue
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main() |