Re: silly problems with program directory



On 08/06/06, David Nečas (Yeti) <yeti physics muni cz> wrote:

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.


Thanks, for that  it seems that common sense is the normal in this case as
that's what I ve done so far in my programs, ie use some kind of command
line argument specifying the program directory. However, my "fears" are true
as 1) A simple user wont have a clue of what a command line argument is 2) A
simple user would prefer a double-click execute-program behaviour which
leaves me with the option the way I see it of writing some kind of
install-file (*swear*):). I wonder how evinve is setup for example as you
can create a link anywhere and it will run just fine....

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


Don't know what is that but thanks for the direction.... Will have a look on
the manual.

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

Yeti


--
Anonyms eat their boogers.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




--
-- Yiannis


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