Starting a deployed app through the installer shortcut uses the shortcut directory as workspace instead of the executables directory.

6 ビュー (過去 30 日間)
Hi,
I am trying to read in some data on startup in my compiled app. I am using
[~, result] = system('set PATH');
appDir = char(regexpi(result, 'Path=(.*?);', 'tokens', 'once'));
to get the directory of the app. This works fine if I start the app through the executable.
But it doesnt work when I start the app via the shortcut.
Does anybody have an idea how to fix this behaviour?
Thanks!

採用された回答

Manoj Mirge
Manoj Mirge 2023 年 8 月 18 日
I understand that you have installed the MATLAB compiled app and while installing the app you have created the shortcut of the app on desktop. The executable when opened from the shortcut runs in a different path than when opened from folder.
The executable’s shortcut which is created while installing the executable will always execute from the directory in which the shortcut is stored. In most cases the shortcut is stored on desktop and hence the executable opens from desktop directory.
I could not find the workaround to change these behaviors of shortcut of the executable.
However, if your workflow permits, you may create the shortcut of executable manually instead of creating the shortcut while installing the executable. And then manually move the shortcut to the desktop. This shortcut would run from the directory in which the executable is installed.
To create the shortcut of the executable manually, you may select the executable file from folder and right click on mouse and in the options select “create shortcut” option. Then manually move the shortcut file to the desktop.
I hope this helps.
  1 件のコメント
Christian Hermann
Christian Hermann 2023 年 8 月 21 日
Thank you for statement, I thought that it was something like that.
I used a different tool to create an Installer as workaround, which made it possible to create folders and copy files in user directorys while installing. I then "hardcoded" those directorys in my app.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by