-3

https://unix.stackexchange.com/a/76641/674

Create a short shell script to run your wine program in this directory, i.e. ~/bin/textaloud:

#!/bin/bash
cd "~/.wine/drive_c"
exec wine "~/.wine/drive_c/Program Files/TextAloud/TextAloudMP3.exe" "$@"

And give it execute permission.

chmod +x ~/bin/textaloud

There are three things to note about the above script:

  • The cd path is where the program is going to be run (in which directory). Some programs may require you to run them on a specific directory. If you have trouble with this, set there that directory (usually the same where the executable is located). You may unwant this line in some cases.

In what cases may some programs require you to run them on a specific directory in Linux?

Thanks.

3
  • 1
    This is a Windows question, though it wasn't very clear in the text you quote. – Michael Homer Mar 21 '18 at 4:37
  • Thanks. I should ask whether it also happends in Linux, and what cases there are. – Tim Mar 21 '18 at 4:44
  • This is far too broad a question. You cannot reasonably expect answerers to enumerate all cases of programs that do stuff relative to their working directories and so require that specific working directories be set if specific directories are to be acted upon. – JdeBP Mar 21 '18 at 8:10
1

Changing the CWD may not be the only way to accomplish this but archive programs usually extract to the CWD.

You may also want to make a program unaffected by renaming a directory or changing symlinks which would be part of a path argument and use ./ paths instead.

You can also prevent a volume from being unmounted by making CWD part of it.

1

If a program needs to be started in a specific directory, there are usually two possible reasons for that:

  • The program's configuration includes non-absolute path names, and they will only point to correct locations when the program is started in that specific directory.

(If a program is configured like this, and no effort is made to ensure the directory is automatically set correctly before starting the actual program, e.g. by writing a simple start-up script for it, you're asking for mistakes.)

  • The program expects to find something specific in the directory it's started in, and will use that in its processing. The command make works like this: if you run it, it will expect to find a file named Makefile or makefile in the current directory, identifying the dependencies between files and commands to run if a file is newer than the files that depend on it. This allows, among other things, a developer to save time recompiling only those parts of a large program that have been modified since the previous build.

(Modern GNU make will perform some pre-set basic tasks even without a Makefile, but this is a very limited feature set compared to what can be achieved with a Makefile.)

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