-
Notifications
You must be signed in to change notification settings - Fork 54
Description
I had the task of generating an MSI in French while also changing the installation scope from per-machine to per-user. The default GluonFX/Substrate plugin hardcodes the MSI template (main.wxs) and the installation scope, making the task non-trivial.
Challenge
The plugin seems to copy main.wxs from its internal resources and immediately invokes WiX to build the MSI.
Solution
Forked the project to introduce configurable system properties, something like:
var mainWxsOverride=System.getProperty("gluonfx.wix.main");
if (mainWxsOverride!=null) {
Path custom = Paths.get(mainWxsOverride);
if(Files.exists(custom))
Files.copy(custom, wixPath, REPLACE_EXISTING);
// TODO else
} else {
FileOps.copyResource("/native/windows/wix/main.wxs", wixPath);
}
....
String cultureOverride=System.getProperty("gluonfx.wix.culture");
String culture="en-us";
if(cultureOverride!=null)
culture=cultureOverride;
processArgs.addAll(List.of(
WixTool.LIGHT.getPath(),
"-nologo",
"-spdb",
"-sw1076", // https://github.com/wixtoolset/issues/issues/5938
"-ext", "WixUtilExtension",
"-ext", "WixUIExtension",
"-cultures:"+culture,
"-out", msiPath.toString(),
wixObjPath.toString()
));
Outcome
-
Successfully generated a French MSI with per-user installation.
-
This approach can be reused for other languages or custom MSI templates in future projects.
Conclusion
I am open to any alternative solutions or suggestions if there is a better way to handle this in the plugin or WiX configuration that I might have missed. My goal was to implement a clean, maintainable solution without relying on hacks, but I welcome feedback if there is a more efficient or standard approach.