fixed newlines and other windows stuff
This commit is contained in:
parent
1f26e8a9ce
commit
c15343b4b8
4 changed files with 32 additions and 24 deletions
|
|
@ -12,7 +12,7 @@ from multiprocessing import Pool
|
|||
def update_names(dir_in, old_path, languages, is_global):
|
||||
names = extract_names(dir_in, is_global)
|
||||
|
||||
global_languages = {"enm": 1, "zh": 2, "ko": 3}
|
||||
global_languages = {"enm": 1, "zho": 2, "kor": 3}
|
||||
if is_global:
|
||||
languages = global_languages.keys()
|
||||
|
||||
|
|
@ -33,12 +33,12 @@ def update_names(dir_in, old_path, languages, is_global):
|
|||
|
||||
langfile = os.path.join(old_path, "nametranslations_{}.json".format(l))
|
||||
if os.path.isfile(langfile):
|
||||
with open(langfile, "r") as lang_file:
|
||||
with open(langfile, "r", encoding="utf-8") as lang_file:
|
||||
lang_dict = json.load(lang_file)
|
||||
out_dict.update(lang_dict)
|
||||
|
||||
with io.open(
|
||||
langfile, "w", newline="\n"
|
||||
langfile, "w", encoding="utf-8"
|
||||
) as lang_file: # you're using git right
|
||||
json.dump(
|
||||
out_dict, lang_file, ensure_ascii=False, indent="\t", sort_keys=True,
|
||||
|
|
@ -56,7 +56,7 @@ def extract_names(dir_in, is_global):
|
|||
files = [
|
||||
f
|
||||
for f in glob(os.path.join(dir_in, "**/*.tsv"), recursive=True)
|
||||
if re.search(r"/[0-9]{9}\.tsv$", f)
|
||||
if re.search(r"[0-9]{9}\.tsv$", f)
|
||||
]
|
||||
if len(files) == 0:
|
||||
raise FileNotFoundError("No valid files found in directory: " + dir_in)
|
||||
|
|
@ -78,7 +78,7 @@ def read_char_tsv(char_tsv_path, is_global):
|
|||
char_names = set()
|
||||
char_sets = set()
|
||||
|
||||
with open(char_tsv_path, "r") as char_tsv_file:
|
||||
with open(char_tsv_path, "r", encoding="utf-8") as char_tsv_file:
|
||||
char_tsv = csv.DictReader(char_tsv_file, delimiter="\t", quotechar='"')
|
||||
|
||||
for row in char_tsv:
|
||||
|
|
@ -103,7 +103,7 @@ def read_char_tsv(char_tsv_path, is_global):
|
|||
|
||||
def read_mission(tsv_path, char_names, char_sets):
|
||||
new_names = set()
|
||||
with open(tsv_path, "r") as tsv_file:
|
||||
with open(tsv_path, "r", encoding="utf-8") as tsv_file:
|
||||
tsv = csv.DictReader(tsv_file, delimiter="\t", quotechar='"')
|
||||
if (
|
||||
("Arg1" not in tsv.fieldnames)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue