The last post about overwriting existing installation was 3 years ago on QtIFW 2, 3, so I hope this won't count as duplicate posting.
I have a Mac installer setup that have 2 components: a standalone app, a VST3 audio plugin.
The standalone is located in @TargetDir@ (which is /Applications/MyApp
) and the plugin is located in (/Library/Audio/Plug-Ins/VST/MyApp.vst3
)
To install the vst3 in Library I use CopyDirectory on createOperationsForArchive
in the installscript.qs
// File at installer/packages/com.packagename/meta/installscript.qs
function Component()
{
}
Component.prototype.createOperationsForArchive = function(archive)
{
// Extract data to pluto folder in Orpheus
component.addOperation("Extract", archive, "@TargetDir@/myplugin/");
// Copy plugin to Library
component.addElevatedOperation(
"CopyDirectory",
"@TargetDir@/myplugin/Myplugin.component",
"/Library/Audio/Plug-Ins/Components/"
);
}
I would like the installer to be able to overwrite the app if already exists. My thinking was to add a remove script before CopyDirectory
. So I added below codes to before CopyDirectory operation:
component.addElevatedOperation(
"Execute", "bash",
"rm", "-rf", "/Library/Audio/Plug-Ins/Components/Pluto.component"
);
But I got permission error exit code 126.
I also tried Rmdir
operation, but got Cannon remove directory
error with Undefined error:0
error.
Another option seems to be to invoke maintenance tool
but I don't know how to add a specific path to delete for the plugin as the maintenance tool will only delete what is in TargetDir
.
Any suggestion please?