Repository navigation
Expand file tree
/
Copy pathgen_files.py
More file actions
47 lines (39 loc) · 1.67 KB
/
Copy pathgen_files.py
File metadata and controls
47 lines (39 loc) · 1.67 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""
Magic Vision Patch
Copyright (C) 2026 ArcticFoxPro
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import os
root = os.path.dirname(os.path.abspath(__file__))
exclude_files = {"[NSIS].nsi", "[NSIS].exe", "files_section.nsh", "gen_files.py"}
exclude_dirs = {"$PLUGINSDIR", ".git"}
out = []
for dirpath, dirnames, filenames in os.walk(root):
dirnames[:] = [d for d in sorted(dirnames) if d not in exclude_dirs]
rel = os.path.relpath(dirpath, root)
if rel == ".":
out.append(' SetOutPath "$INSTDIR"')
else:
rel_nsis = rel.replace("/", "\\")
out.append(f' SetOutPath "$INSTDIR\\{rel_nsis}"')
for f in sorted(filenames):
if f in exclude_files or f.startswith("MagicAnimation_Setup"):
continue
if rel == ".":
out.append(f' File "{f}"')
else:
src = os.path.join(rel, f).replace("/", "\\")
out.append(f' File "{src}"')
output = os.path.join(root, "files_section.nsh")
with open(output, "w", encoding="utf-8-sig") as fh:
fh.write("\n".join(out))
print(f"Wrote {len(out)} lines to {output}")