Debugging KParts

David Faure faure at kde.org
Mon Feb 7 10:52:32 GMT 2005


On Friday 04 February 2005 23:00, Adam Treat wrote:
> On Friday 04 February 2005 11:13 am, David Faure wrote:
> > Hmm, what you want is something like KStandardDirs::addResourceDirs(
> > "module", $builddir ), and addResourceDirs( "services", $srcdir ) to find
> > the .desktop file if the part has never been installed, but the point is to
> > do those things without modifying the source code, right?
> >
> > One solution would be to add some code to KStandardDirs::addKDEDefaults(),
> > which reads from an env. var ($KDE_BUILDDIR?) set by kdevelop. Doesn't
> > solve the problem for those who just run ./foo from a shell without using
> > kdevelop though.
> >
> > So I'd rather see a solution like: adding a stat() in KStandardDirs to
> > check if there's a Makefile in the same dir as the binary, read the srcdir
> > and builddir from it, and add them to the correct resources.
> > It sounds a bit fragile to rely on Makefile syntax, but I don't see another
> > way to do it, which would work with srcdir!=builddir, except hacking
> > libtool to pass one or two env vars for the first solution.
> 
> This doesn't solve the problem for those projects using other build tools 
> though.  Granted, there probably aren't that much, if any, but why not check 
> for a custom file ... say 'kparts.env' in the same dir as the binary.  Those 
> who wish to debug kparts without installing can place one of these in their 
> project no matter what build tool they are using.  KDevelop can automatically 
> include one.  'kparts.env' could use standard ini format and include 
> references to srcdir and builddir. 

OK I should mention that this isn't specific to kparts - any very basic KDE app
that uses XMLGUI and isn't installed, has this very problem. So it would be a
"kde.env" or something. Sounds like a nice alternative, but it doesn't replace
the getting-it-from-Makefile solution IMHO, which has the advantage that no
user intervention is needed (no beginner who tries ./kmyapp will have the idea
of creating kde.env by himself/herself).

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list