In compiled app, "pwd" is returning Matlab code directory rather than application .exe directory. Why and how can I fix this?
35 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Richard Livingston
el 22 de Jun. de 2016
Comentada: Thomas
el 3 de Abr. de 2020
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 comentario
Thomas
el 3 de Abr. de 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!
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Introduction to Installation and Licensing 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!