KConfigBase::read(List)PathEntry and symlinks

Andras Mantia amantia at kde.org
Wed Sep 6 17:02:09 BST 2006

On Wednesday 06 September 2006 17:34, David Faure wrote:
> If the app deals with resolved paths internally, then it should
> probably resolve paths when writing them out for consistency?

Right. ;-)

> Although this breaks when changing the link to somewhere else (e.g.
> moving your home to another partition), so working with resolved
> paths doesn't sound like a very good idea over all.

Well, I had several issues with symlinks until I started to resolve the 
paths internally. 
The current problem appeared mainly because if you query for a local 
resource directory from KStandardDirs it gives you a resolved path. If 
you read an entry with readPathEntry it gives an unresolved path. So 
comparing the two always failed, even if they pointed to the same file.

> >  Would be nice if such resolving could be done on the kdelibs
> > level, altough I'm afraid in KDE3 it would break existing
> > applications. So what I suggest for KDE4 is:
> > - in read/write path entry after getting the $HOME env. var,
> > resolve it
> read: that's the third item below
> write: not sure what you mean.

Forget it, this is just the second + third item together.

> > - when writing replace part of the path with the string "$HOME" if
> > the path contains the resolved OR unresolved $HOME
> OK so cleanHomeDirPath() should realpath(homeDir), and if it gets a
> different than homeDir it should look for both in <path>. This sounds
> like a good idea in any case.

Yes, something like that.

> > - in read, always return the resolved path
> I disagree with that one. If the user selected a file in /home/foo,
> he should still see /home/foo after the app restarts.

Makes sense. I don't know how many app writers use resolved path 
internally, but if they do, maybe it makes sense to provide a resolved 
version of readPathEntry in the kdelibs API. If there is no such 
request, no problem, I can have my own version in the application 
itself. ;-)


Quanta Plus developer - http://quanta.kdewebdev.org
K Desktop Environment - http://www.kde.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060906/0ed60c3b/attachment.sig>

More information about the kde-core-devel mailing list