[Glade-users] Universal glade path

Hey, I make program using glade so my binary depend on GUI file
configuration, called blabla.glade. Here's the code:

        Glib::RefPtr<Gnome::Glade::Xml> refXml;
            try {
                refXml = Gnome::Glade::Xml::create("blabla.glade");
            catch(const Gnome::Glade::XmlError& ex) {

The problem is... I have to run the program it self in its directory:

$ cd /usr/bin
$ ./myprogram

Ok, it is successfull
But I cann't do this.
$ /usr/bin/myprogram
or assume /usr/bin is in $PATH so I can just type
$ myprogram

I will get this error:
libglade-WARNING **: could not find glade file 'blabla.glade'
Failed to load glade file `blabla.glade'

So, is there any simple solution? 
I know I can open the pipe for this process: "which myprogram" and save
the output ( /usr/bin/myprogram ) to stream. Then I read the stream into
character array. But that is not practical. 

I want to distribute my program to people and my users have right to
install whereever they like. So that when they install in /usr/bin, my
installer will copy my program and its glade file into that directory.
And when user type myprogram ( /usr/bin in $PATH directory ), it will
load glade file successfully. But they maybe want to install in
/usr/local/bin..... So is there any practical solution? How can we
locate the binary it self in practical way? 

Maybe you can help me, guyz.....

Thank you.......

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