@Straticah Yeah, this is my code to install the expansions (i'm actually saving other things on that json file, so that's why I used "SampleFolder" to retrieve it from the json)
var CompletePath;
inline function InstallPackage()
{
local parentFolder = FileSystem.getFolder("../");
local SampleFile = parentFolder.getChildFile("settings.json");
local SampleObject = SampleFile.loadAsObject();
local DirectoryFile = FileSystem.fromAbsolutePath(SampleObject.SampleFolder);
CompletePath = DirectoryFile.createDirectory(InstrumentName);
if (CompletePath.isDirectory())
{
expHandler.installExpansionFromPackage(selectedInstrumentFile, CompletePath);
}
else
{
Console.print("Could not create the installation directory.");
}
}
When I use expHandler.installExpansionFromPackage, it creates the link file on expansion samples folder with the samples path. It always worked for me, and I never received a support ticket.
And then I created my own button to change the samples path on settings. This will change the sample paths for all the expansions.
inline function onbtnChangeSamplesDirectoryControl(component, value)
{
if (value)
{
FileSystem.browseForDirectory("", function(selectedFolder)
{
if (selectedFolder)
{
if (selectedFolder.hasWriteAccess())
{
var path = selectedFolder.toString(0);
currentSampleFolderPath = path;
var notFound = [];
for (e in expHandler.getExpansionList())
{
var name = e.getProperties().Name;
var fullPath = path + "/" + name;
var folderObject = FileSystem.fromAbsolutePath(fullPath);
if (folderObject.isDirectory())
{
e.setSampleFolder(folderObject);
}
else
{
notFound.push(name);
}
}
if (notFound.length > 0)
{
Console.print("Not found");
}
else
{
Console.print("All sample folders updated successfully");
}
}
else
{
Console.print("The selected folder can't be accessed due to insufficient write permissions. Please choose a different folder.");
}
}
});
}
};
Content.getComponent("btnChangeSamplesDirectory").setControlCallback(onbtnChangeSamplesDirectoryControl);