Skip to content

Commit d890f41

Browse files
Fix deep-dir archives
Packing and unpacking of the archives with more rooted directories.
1 parent 5d0a88a commit d890f41

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

ai6win_arc.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ def _pack_names_and_files(self) -> tuple:
7171

7272
rel_name = os.path.normpath(os.path.join(root, filename))
7373
end_name = rel_name
74-
if rel_name.startswith(root + os.sep):
75-
end_name = rel_name[len(root + os.sep):]
74+
if rel_name.startswith(self._dir_name + os.sep):
75+
end_name = rel_name[len(self._dir_name + os.sep):]
76+
end_name = end_name.replace(os.sep, '/')
7677
encrypted_name = self.encrypt_name(end_name)
7778

7879
with open(rel_name, 'rb') as this_file:

main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ def test(mode: str):
77
from ai6win_arc import AI6WINArc
88
"""modes: unpack, pack,"""
99
if mode == "unpack":
10-
test_arc = AI6WINArc("Data.arc", "Data", integrity_check=True)
10+
test_arc = AI6WINArc("mes.arc", "mes", integrity_check=True)
1111
test_arc.unpack()
1212
elif mode == "pack":
13-
test_arc = AI6WINArc("Data.arc", "Data", integrity_check=True)
13+
test_arc = AI6WINArc("mes.arc", "mes", integrity_check=True)
1414
test_arc.pack()
1515

1616

setup.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88

99

1010
executables = [cx_Freeze.Executable("main.py",
11-
shortcut_name="SilkyArcTool",
12-
shortcut_dir="SilkyArcTool",
13-
#base="Win32GUI")
14-
]
11+
shortcut_name="AI6WINArcTool",
12+
shortcut_dir="AI6WINArcTool",
13+
#base="Win32GUI"
14+
)]
1515

1616
cx_Freeze.setup(
17-
name="SilkyArcTool",
18-
version="1.0",
17+
name="AI6WINArcTool",
18+
version="1.1",
1919
description="Dual languaged (rus+eng) tool for packing and unpacking archives of Silky Engine.\n"
2020
"Двуязычное средство (рус+англ) для распаковки и запаковки архивов Silky Engine.",
2121
options={"build_exe": {"packages": []}},

silky_arc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def _unpack_files(self) -> None:
123123
except AssertionError:
124124
print("!!! File {0} true size is incorrect!/Истинный размер файла {0} некорректен!".
125125
format(i[1]))
126+
os.makedirs(os.path.dirname(this_file_name), exist_ok=True)
126127
with open(this_file_name, 'wb') as this_file:
127128
this_file.write(new_file_bytes)
128129
if self._verbose:

0 commit comments

Comments
 (0)