Skip to content

Commit a69b57a

Browse files
committed
wix4
1 parent d093283 commit a69b57a

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

scripts/create_windows_msi.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,18 +176,29 @@ def create_wix_files(input_dir, version):
176176
# Create a components file with proper directory structure for WiX 4
177177
# Use forward slashes for paths to avoid escaping issues
178178
input_dir_forward = input_dir.replace('\\', '/')
179+
180+
# Get a list of all files in the directory except GetDistGUI.exe
181+
files = []
182+
for file in os.listdir(input_dir):
183+
if file != "GetDistGUI.exe" and os.path.isfile(os.path.join(input_dir, file)):
184+
files.append(file)
185+
186+
# Create component entries for each file
187+
file_components = ""
188+
for i, file in enumerate(files):
189+
file_id = f"File{i+1}"
190+
file_components += f"""
191+
<Component Id="Component{i+1}" Guid="*">
192+
<File Id="{file_id}" Source="{input_dir_forward}/{file}" KeyPath="yes" />
193+
</Component>"""
194+
179195
components_content = f"""<?xml version="1.0" encoding="UTF-8"?>
180196
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
181197
<Fragment>
182198
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
183199
<Component Id="MainExecutable" Guid="*">
184200
<File Id="GetDistGUIEXE" Source="{input_dir_forward}/GetDistGUI.exe" KeyPath="yes" />
185-
</Component>
186-
187-
<!-- Add a component for each file in the directory -->
188-
<Component Id="AppFiles" Guid="*">
189-
<File Source="{input_dir_forward}/*" Exclude="GetDistGUI.exe" />
190-
</Component>
201+
</Component>{file_components}
191202
</ComponentGroup>
192203
</Fragment>
193204
</Wix>

0 commit comments

Comments
 (0)