In compiled app, "pwd" is returning Matlab code directory rather than application .exe directory. Why and how can I fix this?
조회 수: 35 (최근 30일)
이전 댓글 표시
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
Thomas
2020년 4월 3일
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!
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!