52 lines
1.0 KiB
Python
Executable File
52 lines
1.0 KiB
Python
Executable File
#!/usr/bin/pyhton3
|
|
import os
|
|
import re
|
|
from fnmatch import fnmatch
|
|
|
|
_path = r'C:/Users/riksl/PycharmProjects/weapon-project-extended/data/scripts/'
|
|
|
|
name = "weapongenerator.lua"
|
|
|
|
|
|
def _lister(_path) -> list:
|
|
_list: list = []
|
|
try:
|
|
pattern = "*.lua"
|
|
|
|
for path, subdirs, files in os.scandir(_path):
|
|
for name in files:
|
|
if fnmatch(name, pattern):
|
|
print(os.path.join(path, name))
|
|
_list.extend(f"{path}/{name}")
|
|
break
|
|
return sorted(_list)
|
|
except TypeError:
|
|
pass
|
|
|
|
|
|
print(_path)
|
|
print(_lister(_path))
|
|
|
|
|
|
def parsing_file(f):
|
|
with open(f) as _f:
|
|
_cached = _f.read()
|
|
|
|
_list = _cached.split('\n')
|
|
_to_translate = []
|
|
|
|
for _str in _list:
|
|
if _str.find('%_t') != -1 or _str.find('%_T') != -1:
|
|
_to_translate.append(_str)
|
|
|
|
return _to_translate
|
|
|
|
|
|
for _str in parsing_file(name):
|
|
test = re.findall('= "(.*[^/])(?: /\* (.*)\*/)?"%_[t|T]', _str)
|
|
# print(test)
|
|
|
|
|
|
def all_to_translate():
|
|
pass
|