Re: silly problems with program directory



On Thu, Jun 08, 2006 at 04:47:13PM +0100, Yiannis wrote:
I am having a slight problem with the program directory. What I mean is that
when I run a program from the directory that all the files are lying it is
fine.... but if I create a symbolic link and I run it from another directory
then the program directory is the current one of the symbolic link which
means that none of my configuration and glade xml files are found.... Is
there any easy solution to that?

The solution is NOT to make your program dependent on the
directory it was run from and use compiled-in paths [+ env
variables] [+ command line options] to specify the location
-- which I believe is the norm.

But if you insist, you can use g_file_read_link() and
resolve the symlinks (or realpath() if the target OSes
provide it).

But it will break anyway if someone makes a hardlink or
simply copies the binary somewhere.

Yeti


--
Anonyms eat their boogers.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]