@WillowWolf said in Mac installer for audio sample libraries best practices?:
@Lindon
What was your approach to making an in plugin setup for samples?
Any advice or suggestions would be helpful, since I'm exploring a similar route.
Ok so...
I have a json file that is saved by the plugin to the AppData folder, this is the Setup manifest - here's an example, as it is defined in the code:
reg defaultInstallManifest =
{
"DownloadTargetFolder" : "Not Set",
"DownloadApproach" : "",
"downloadSpace": 3670,
"samplerSpace" : 3990,
"version" : 30000,
"type": "setup",
"setupSteps" :
[
{
"downloadFileName" : "www.xxxxx.com/download/zzzzz/ProductNameData01.cra", // Sample files ch1
"downloadFileDestination" : "ProductNameData01.cra",
"downloadFileContents" : "Sample Files",
"installDestination" : destinations.USERSAMPLE_LOCATION,
"status" : destinations.UNSTARTED
},
{
"downloadFileName" : "www.xxxxx.com/download/zzzzz/ProductNameData02.cra", // Sample files ch1
"downloadFileDestination" : "ProductNameData02.cra",
"downloadFileContents" : "Sample Files",
"installDestination" : destinations.USERSAMPLE_LOCATION,
"status" : destinations.UNSTARTED
},
{
"downloadFileName" : "www.xxxxx.com/download/zzzzz/ProductNameData03.cra", // Sample files ch1
"downloadFileDestination" : "ProductNameData03.cra",
"downloadFileContents" : "Sample Files",
"installDestination" : destinations.USERSAMPLE_LOCATION,
"status" : destinations.UNSTARTED
},
{
"downloadFileName" : "www.xxxxx.com/download/zzzzz/ProductNameData04.cra", // Sample files ch1
"downloadFileDestination" : "ProductNameData04.cra",
"downloadFileContents" : "Sample Files",
"installDestination" : destinations.USERSAMPLE_LOCATION,
"status" : destinations.UNSTARTED
},
{
"downloadFileName" : "www.xxxxx.com/download/zzzzz/ProductNameData05.cra", // Sample files ch1
"downloadFileDestination" : "ProductNameData05.cra",
"downloadFileContents" : "Sample Files",
"installDestination" : destinations.USERSAMPLE_LOCATION,
"status" : destinations.UNSTARTED
},
{
"downloadFileName" : "www.xxxxx.com/download/zzzzz/ProductNameData06.cra", // Sample files ch1
"downloadFileDestination" : "ProductNameData06.cra",
"downloadFileContents" : "Sample Files",
"installDestination" : destinations.USERSAMPLE_LOCATION,
"status" : destinations.UNSTARTED
},
{
"downloadFileName" : "www.xxxxx.com/download/zzzzz/ProductNameData07.cra", // Sample files ch1
"downloadFileDestination" : "ProductNameData07.cra",
"downloadFileContents" : "Sample Files",
"installDestination" : destinations.USERSAMPLE_LOCATION,
"status" : destinations.UNSTARTED
},
{
"downloadFileName" : "www.xxxxx.com/download/zzzzz/ProductNameData08.cra", // Sample files ch1
"downloadFileDestination" : "ProductNameData08.cra",
"downloadFileContents" : "Sample Files",
"installDestination" : destinations.USERSAMPLE_LOCATION,
"status" : destinations.UNSTARTED
},
{
"downloadFileName" : "www.xxxxx.com/download/zzzzz/ProductNameData09.cra", // Sample files ch1
"downloadFileDestination" : "ProductNameData09.cra",
"downloadFileContents" : "Loop Files",
"installDestination" : destinations.USERSAMPLE_LOCATION,
"status" : destinations.UNSTARTED
},
{
"downloadFileName" : "www.xxxxx.com/download/zzzzz/ProductNameData10.cra", //the meta files
"downloadFileDestination" : "ProductNameData10.cra",
"downloadFileContents" : "Meta Data Files",
"installDestination" : destinations.APPDATA_LOCATION,
"status" : destinations.UNSTARTED
},
{
"downloadFileName" : "www.xxxxx.com/download/zzzzz/ProductNameData11.cra", // audio wav files
"downloadFileDestination" : "ProductNameData11.cra",
"downloadFileContents" : "Audio Files",
"installDestination" : destinations.AUDIOFILES_LOCATION,
"status" : destinations.UNSTARTED
},
{
"downloadFileName" : "www.xxxxx.com/download/zzzzz/ProductNameData12.cra", // presets
"downloadFileDestination" : "ProductNameData12.cra",
"downloadFileContents" : "Preset Files",
"installDestination" : destinations.PRESETS_LOCATION,
"status" : destinations.UNSTARTED
}
]
};
So on start up the plugin looks for a manifest file in the AppData folder, and when it doesnt find it - then it knows that there is a set up to do....so it uses this internally included version (above) of this file to do the set up...
It should be pretty obvious, what is happening. There are a bunch of file URLs that point to stuff that needs to be downloaded, so first the plugin installer asks where the user wants to put these temp download files...and it checks there's enough room in the user specified location...
If there is enough room it iterates over the steps downloading these files ( I usually limit the file sizes to about 500MB), as each is done it updates the step status to "downloaded"...
When everything has been downloaded it checks to see if there is any sample data in the manifest, if there is it asks the user where they want to keep their sample data on a permanent basis...it checks there is enough space in the users requested location.
If there is it creates a "Link File" and begins the unarchiving process for each step putting the contents of each downloaded file in its final location and updating the manifest on disk as it does so with the status "installed"....
When its done it offers the user the opportunity to delete those temp download files and tells the user to restart the plugin...
The plugin restarts, finds the Manifest file, checks its all been completed("installed") successfully and if it has it starts to run like a normal plugin....
The system includes an off-line setup process too - but the number of users who have opted for this as tiny tiny tiny...
It took very little effort to enhance this to allow the plugin to download and install expansions too...essentially this will download and set up for you: samples, their link file, meta data, wav files, graphics, basically anything you can zip up and know the location you want to use...
With this approach the only thing the "classic" installer (like whitebox etc.) has to do is put the VST3 and AU files wherever you want them...
This whole sub system is actually available to license from me if you wish...