Effacer les filtres
Effacer les filtres

In compiled app, "pwd" is returning Matlab code directory rather than application .exe directory. Why and how can I fix this?

36 vues (au cours des 30 derniers jours)
I have a compiled application that needs to load a settings file. I'm using "pwd" to get the current program working directory, but instead of returning the compiled application directory ('C:\Programs\Singulex\{appname}') it is returning the code directory instead. It is as if the compiler evaluates "pwd" during compile time and sticks that into the code. I've tried setting the application directories to 'C:\Programs\Singulex\{appname}' in the compiler application project, but that doesn't affect this.
  1 commentaire
Thomas
Thomas le 3 Avr 2020
This is very confusing, but this is what works for me with R2019b.
Files bundled with your compiled app under "Files installed for your end user" are installed in the installation directory ("C\Program Files\{appname}\application"). You can find this folder using getenv('ProgramFiles'), and this will work as long as user installs in the default directory.
Files bundled with your compiled app under "Files required for your application to run" are installed in the ctfroot directory. However, for me, it is not installed there, but in a subfolder, and the name of the folder is a substring of the application name. You can use this if you see what the name of this subfolder is and hard code it, or write some code to look for the correct directory name dynamically.
So you have two options, but neither is bulletproof.
If I am doing it wrong, I would be overjoyed to have my ignorance and incompetence exposed!

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 23 Juin 2016

Plus de réponses (0)

Catégories

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

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by