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 CenterFile Exchange 中查找有关 Introduction 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