Nautilus and dirname
1) I have a program that save stuff in the same directory as where it is started. Thus for example, if my program executable is in the directory /tmp/mydir and my program is called myexecutable, its full path is /tmp/mydir/myexecutable
2) Now 'myexecutable' is a program that reads and write files from the very same directory.
3) If I run 'myexecutable' from the command line from directory /tmp/mydir/myexecutable everything works perfectly.
QUESTION: I want to use a Nautilus launcher on the desktop that starts 'myexecutable'. Simple right, just make a launcher and enter as command 'myexecutable'.
PROBLEM: Nautilus always assumes that the working directory is /home/myuser , but the program will only work correctly if it is started in /tmp/mydir
SOLUTIONS: Is there a way to tell Nautilus what the working dir should be?
The alternative is that I program myexecutable such that it just opens files with the full pathname. But in reality this program can be anywhere. Is there a 'simple' way in Linux gcc to tell where the called binary is that you are calling. Is this in the /proc files somewhere.
Help is appreciated!
Thanks.
Gilberto
|