Skip to content

Commit e7301f1

Browse files
Fix filenames with ".."
1 parent b3fe035 commit e7301f1

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
cx_Freeze.setup(
1515
name="mesScriptAsseAndDisassembler",
16-
version="1.2",
16+
version="1.3",
1717
description="Dual languaged (rus+eng) tool for packing and unpacking mes scripts of Silky Engine.\n"
1818
"Двухязычное средство (рус+англ) для распаковки и запаковки скриптов mes Silky Engine.",
1919
options={"build_exe": {"packages": []}},

silky_mes.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class SilkyMesScript:
99

1010
# [Opcode, struct, name].
1111
command_library = (
12-
(0x00, '', 'NULL'),
12+
(0x00, '', 'RETURN'),
1313
(0x01, 'I', ''), # Found only in LIBLARY.LIB
1414
(0x02, '', ''),
1515
(0x03, '', ''), # Found only in LIBLARY.LIB
@@ -36,8 +36,8 @@ class SilkyMesScript:
3636
(0x1B, '>I', ''),
3737
(0x1C, 'B', 'TO_NEW_STRING'),
3838

39-
(0x32, '>hh', ''),
40-
(0x33, 'S', 'STR_RAW'),
39+
(0x32, 'i', 'PUSH'),
40+
(0x33, 'S', 'PUSH_STR'),
4141
(0x34, '', ''),
4242
(0x35, '', ''),
4343
(0x36, 'B', 'JUMP_2'),

silky_mes_gui.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -455,11 +455,16 @@ def _disassemble(self) -> bool:
455455
else: # Dir mode.
456456
files_to_manage = []
457457
os.makedirs(txt_file, exist_ok=True)
458+
falkeze = len(mes_file.split(os.sep))
458459
for root, dirs, files in os.walk(mes_file):
459460
for file_name in files:
460461
new_file_array = [] # mes_file, txt_file
461462

462-
basic_path = os.sep.join(os.path.join(root, file_name).split(os.sep)[1:])
463+
basic_path = os.sep.join(os.path.join(root, file_name).split(os.sep)[falkeze:])
464+
print(basic_path)
465+
print(mes_file)
466+
print(os.path.join(mes_file, basic_path))
467+
print(os.path.normpath(os.path.join(mes_file, basic_path)))
463468
rel_mes_name = os.path.normpath(os.path.join(mes_file, basic_path))
464469
rel_txt_name = os.path.normpath(os.path.join(txt_file, os.path.splitext(basic_path)[0] + ".txt"))
465470

@@ -528,11 +533,12 @@ def _assemble(self) -> bool:
528533
else: # Dir mode.
529534
files_to_manage = []
530535
os.makedirs(txt_file, exist_ok=True)
536+
falkeze = len(txt_file.split(os.sep))
531537
for root, dirs, files in os.walk(txt_file):
532538
for file_name in files:
533539
new_file_array = [] # mes_file, txt_file
534540

535-
basic_path = os.sep.join(os.path.join(root, file_name).split(os.sep)[1:])
541+
basic_path = os.sep.join(os.path.join(root, file_name).split(os.sep)[falkeze:])
536542
rel_mes_name = os.path.normpath(os.path.join(mes_file, os.path.splitext(basic_path)[0] + ".MES"))
537543
rel_txt_name = os.path.normpath(os.path.join(txt_file, basic_path))
538544

@@ -605,6 +611,8 @@ def _get_mes_and_txt(self) -> tuple:
605611
status = False
606612
showwarning(title=self._strings_lib[self._language][22],
607613
message=self._strings_lib[self._language][24])
614+
mes_file = os.path.abspath(mes_file)
615+
txt_file = os.path.abspath(txt_file)
608616
return mes_file, txt_file, status
609617

610618
# Language technical methods.

0 commit comments

Comments
 (0)