Can I make Matlab Compiler give me %SystemDrive% as a Default Install Location option?

6 vues (au cours des 30 derniers jours)
Jacob
Jacob le 10 Juil 2024
Commenté : Jacob le 11 Juil 2024
The Matlab applications that I am creating are being used by multiple people across multiple accounts on the computers that they are installed on. There are certain limits and criteria that I am handling through the use of *.json files that are installed to the same directory as the program. The issue with installing these applications to %ProgramFiles% is that the user needs admin permissions to change anything inside of the *.json files, and due to the Group Policies that we are under, a standard user does not possess the correct permissions for this.
Is there a way that I can manually add the option for %SystemDrive% or %ProgramData% to the Matlab Compiler's list of available options for a Standalone Application? The IT department does not fully understand the installations and the water gets very muddy once they start messing with the filepaths.
The current way I am getting around this is by updating the *.prj file with any new changes when a new release is built, using the createDeploymentScript function to generate a deployment script, and manually changing the %ProgramFiles% or %AppData% in the "packageOpts.DefaultInstallationDir" to %SystemDrive%. This gets the job done, but is cumbersome and very prone to human error when anyone else (who is unfamiliar with the Matlab Compiler program) is attempting a new build.
NOTE: I cannot install to the %AppData% Directory as when an admin remotes in to install the program, it defaults to their %AppData% folder and thus not all users have access to this location.
Any help would be greatly appreciated!

Réponses (1)

Madheswaran
Madheswaran le 11 Juil 2024
Hi,
While using the ‘Application Compiler’ app to create applications, the default installation paths are ‘%ProgramFiles%’ and ‘%AppData%’. However, while installing the application created using MATLAB, the end user can still select the installation location of their choice.
You can create an installer with a specific install location using the function `compiler.package.installer` with option 'DefaultInstallationDir' and the corresponding default installation directory path.
Please follow the below mentioned MATLAB R2024a code that demonstrates the suggested solution:
mainScript = 'main_script.m';
additionalFiles = {'dependency_files.m'}; % Include additional files required by the main script
% Build the standalone application
buildResults = compiler.build.standaloneApplication(mainScript, ...
'AdditionalFiles', additionalFiles, ...
'OutputDir', 'output');
% Package the built application into an installer
compiler.package.installer(buildResults, ...
'DefaultInstallationDir', 'C:\MyOwnApp'); % Set the default installation directory
Please refer to the below mentioned MATLAB R2024a documentations on ‘compiler.package.installer’ and ‘compiler.build.standaloneApplication’:
  1. https://www.mathworks.com/help/releases/R2024a/compiler/compiler.package.installer.html
  2. https://www.mathworks.com/help/releases/R2024a/compiler/compiler.build.standaloneapplication.html
Hope this helps!
  1 commentaire
Jacob
Jacob le 11 Juil 2024
Hi,
First off, thank you for your answer!
However, after reading through some of the documentation and looking at what is generated by the 'createDeploymentScript' function, it seems as though your suggestion would be about the same as using the built-in option for creating a deployment scripts based off of the *.prj file. I am moreso looking to see if there is a way that the 'Application Compiler' can be made to have the option of %SystemDrive% rather than having to manually replace it every time I want to rebuild and generate a new deployment script.
The option of having the user select an install path is known as well, however, I am trying to make the process as seamless as possible such that all that would need done is to run the installer, click through the install options, and let it install and wipe your hands of it. I did some digging through the compiler's source files and there are a lot of *.m files in there related to the compiler's operations and was wondering if there was any additions I could make to provide myself the %SystemDrive% as an available option while going through the compiler, but I couldn't necessarily find where the options for that dropdown were and wasn't going to dig through the MATLAB P Files or binary files to find it. Or alternatively, if maybe in another version of the progrma the option was already available.
Thanks again!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange

Produits


Version

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by