0

Ubuntu 14.04 LTS

I am trying to create a Launcher for a program who runs in wine. Problem is this program is launched through a file loader.exe, which appears to be "location sensitive" meaning that it works or not depending on where it is called from. I have never encountered such odd behavior before and I am baffled.

Example:

If I create a Link to loader.exe (right click --> Make Link) the link will work as long as it is in the same folder as loader.exe, but if I move the link to another folder, loader.exe fails. For this reason I cannot even create a .desktop file to run loader.exe as it exhibits same behavior as the link.

So I have tried running loader.exe in the terminal. If I cd to its location and the run it, the program starts just fine:

user@PC:~$ cd /home/user/program
user@PC:~/program$ wine loader.exe

But if I try to launch it by path the program fails:

user@PC:/$ wine /home/user/program/loader.exe

So I got the idea to create a bash file (script.sh) placed into the same folder as loader.exe thinking this way I can run the bash script from anywhere, and the bash script will execute the loader.exe files from within its folder...

I tried two versions of the script:

#!/bin/bash
wine /home/user/program/loader.exe`
exit

and

#!/bin/bash
wine loader.exe
exit

Both versions fail if I run them clicking on them (or right click --> open with Run software)

Running the scripts from terminal, both versions have same behavior described previously. So if I cd to the program folder and then run the script, this works fine and launches the loader.exe (which runs the program), but if try to run the scripts with absolute path both versions fail.

I think the only option I have left is to create a script which will 1) open a terminal 2) cd to the the location of loader.exe and 3) run it (and then possibly close the terminal window as this seems to have no effect on the running software).

But I have no idea if and how this can be done. Any help would be greatly appreciated.

  • Ubuntu 14.04 has reached its end of life. It is not supported any more and is off-topic here. – user68186 May 14 '20 at 19:54
  • This is not a 14.04 specific subject, it is not even Ubuntu specific actually... – Gumbo May 14 '20 at 20:51
  • Nonetheless this is an Ubuntu specific site where we follow the site rules. If you make the question about a supported version of Ubuntu, such as 16.04, there will be no reason to close this question. – user68186 May 14 '20 at 23:41
2

This is normal behavior for some loader.exe type programs

The loader expects other bits of program files (dll and whatnot) in the folder where it is run from. If those files are not in the current folder the program fails to load.

Try:

#!/bin/bash
cd /home/user/program
wine loader.exe
exit

See: https://wiki.winehq.org/Wine_User%27s_Guide#Use_different_startup_paths

And: https://help.ubuntu.com/community/Wine

Hope this helps

  • I know the .exe files cant be moved in another folder from the installation folder, however this is not the case as the even links to the .exe files fail if they are not placed into the same folder of the .exe file (which makes the use of links useless in the first place). Anyways, the script you suggested works just fine, so thanks a lot for your answer. – Gumbo May 14 '20 at 20:45
  • In the meantime I have managed to solve the problem also with the following script #!/bin/bash gnome-terminal -e 'sh -c "cd /home/user/program; wine loader.exe"' exit Since your script works just fine, looks like it was not required to launch the loader.exe from terminal. – Gumbo May 14 '20 at 20:45
  • See this question for the difference between ; and && in bash. The && is preferable if you want to combine the two lines. – user68186 May 14 '20 at 23:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.