question regarding including the DESTDIR variable as a part of the application's source code

Ian Wadham ianw at netspace.net.au
Thu Dec 25 19:48:59 GMT 2003


----- Original Message ----- 
From: "Ivica Bukvic" <ico at fuse.net>
Sent: Monday, December 22, 2003 12:33 PM


> So my question is what is the best way to have the app aware of the
> install path change, so that it is always able to locate the data files.
> In other words, is it somehow possible to make the source code aware of
> the DESTDIR variable, so that when the app as a stand-alone binary is
> always aware of the path specified at the compile-time?
> 
Some games have this problem.  Also packages like "xfig" (drawing) and
"xephem" (stars and planets) locate their data files somehow and AFAIK
are pure C and X applications, so maybe you could have a look at their
source code and see how they solve it, if you are working in pure C.

If you are working with C++ and Qt library, class KStandardDirs in the
KDE library "kdecore" is the official KDE way to locate files of all
kinds (not just data).  If your application is already a KDE application
(using KMainWindow), KStandardDirs will already be included.  If
it is pure Qt (using QMainWindow), you can include KStandardDirs
and it works fine (I've used it).

KStandardDirs will look wherever KDE is installed (e.g. /opt/kde3)
or through whatever prefixes are set up in the KDEDIRS path variable
or in $HOME/.kde (for files created by the user).  Assuming you are
using GNU system building tools (./configure, make and make install),
data files should be installed in "$(kde_datadir)/yourappname", as
entered when you add your data files to your KDevelop 2 project.

$(kde_datadir) will evaluate to "$(prefix)/share/apps".  End users can
set $(prefix) to whatever they like by using "./configure --prefix xxxx"
when they install, but then they will have to set up KDEDIRS in their
environment, e.g. "export KDEDIRS=$KDEDIRS:xxxx".  Otherwise 
the files -could- go wherever KDE is installed, but that is not a good
solution.  That area should be reserved for files belonging to
official KDE applications.

I hope this is some help, Ian W.

-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«



More information about the KDevelop mailing list