-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmakechars.py
More file actions
29 lines (22 loc) · 720 Bytes
/
makechars.py
File metadata and controls
29 lines (22 loc) · 720 Bytes
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
import os
import sys
arg = __file__
if len(sys.argv) > 1:
arg = sys.argv[1]
os.chdir(os.path.dirname(arg))
charlist = []
def recursive_search_ini(dir):
for f in dir:
if f.is_file():
if f.name.lower() == 'char.ini':
char = os.path.relpath(os.path.dirname(f.path), start=arg)
charlist.append(char.replace("\\", "/"))
print(f'Found character "{char}"!')
elif f.is_dir():
recursive_search_ini(os.scandir(f))
print(f'Scanning "{os.getcwd()}"...')
recursive_search_ini(os.scandir(os.getcwd()))
File = open("characters.yaml", "w")
for char in charlist:
File.write(f'- {char}\n')
input(f"{File.name} has been generated!")