How to get the path of the resource file folder of a packaged app
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
I'm trying to create a simple app that copy a default excel file from his resource folder to a folder selected by the user,
I've inserted the excel file in "shared resources and helper files" while packagine the app and it works because fhe file is in the higlighted (in the screenshot) folder afther the installation of the app.
The problem is that I can find a way to access that file (attached there's the code that works when I run the app from the App Designer, but fails when called from the app bar afther the installation),
so that's my question:
Is there a function in Matlab that returns the resource files folder path (the one higlighted in the photo) of the current application?
Is there another way to get that path?
I don't want to copy that path myself because I had to share this application and I suppose that Windows or Linux store those file in different locations
Thanks!
That's my code:
(displaySystemMessage is a function that I had defined to display messages on a textView)
function PasteDefaultExcelSheetButtonPushed(app, event)
errorFound = false;
try
defaultExcelPath = "Default Excel Input.xlsm";
selectedFolderPath = uigetdir();
copyfile(defaultExcelPath, selectedFolderPath);
catch error
errorFound = true;
app.displaySystemMessage("ERRORE", [error.identifier, newline, error.message]);
end
if ~errorFound
app.displaySystemMessage('STATUS', ['Default Excel File Copied from:', newline, defaultExcelPath]);
end
end
That's the screenshot:
(higlighted the folder that I want to access)
0 comentarios
Respuestas (1)
Simone Parisotto
el 2 de Dic. de 2020
Hi!
you can try the following:
rootSettings = matlab.internal.getSettingsRoot;
addonFolder = rootSettings.matlab.addons.InstallationFolder.ActiveValue;
executableFolder = fullfile(addonFolder,'Apps',name_of_your_app);
Hope it helps!
Simone
0 comentarios
Ver también
Categorías
Más información sobre Environment and Settings en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!