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

5 views (last 30 days)
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!

Accepted Answer

Manoj Mirge
Manoj Mirge on 18 Aug 2023
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 Comment
Christian Hermann
Christian Hermann on 21 Aug 2023
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.

Sign in to comment.

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!