Relative Path
Andras Mantia
amantia at freemail.hu
Tue Jun 3 13:49:22 BST 2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Tuesday 2003 June 03 15:19, Benjamin Meyer wrote:
> For KAudioCreator I needed to find the relative path between two files and
> so I wrote a little function to figure it out after not finding such a
> thing in KURL etc. Would this be something interesting enough to add to
> KURL?
Hi,
If you are interested, there is a similar function in module quanta
(quanta/qextfileinfo.*), called toRelative. The main difference is that it
works with KURL's. There are other useful functions, maybe we can out some
of them in the kdelibs (so I CC to kde-core-devel):
toAbsolute: converts a relative url to absolute one. Maybe it can go to KURL
as a static method.
allFiles: returns in a KURL::List the recursive listing of the current dir
(local or remote). A filtering mask can be specified. This may fit in
KIO::Netaccess.
allFilesRelative: the same, but the returned KURL's will be relative to the
listed directory. This may fit in NetAccess, though.
createDir: creates the directories recursively (dir1/dir2/dir3) will be
correctly created, even if only dir1 exists, or none of the dirs exist.
NetAccess?
cdUp: may be also a nice addition to KURL.
The rest of the methods are internal ones, workarounds for NetAccess bugs and
backports of new NetAccess features (like file_copy).
Andras
>
> -Benjamin Meyer
>
> /**
> * Finds the relative path from path1 to path2
> * returns true is successfull.
> */
> bool relativeURL(const QString &path1, const QString &path2,
> QString &relativePath ) const {
> >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to
> >> unsubscribe <<
- --
Quanta Plus developer - http://quanta.sourceforge.net
K Desktop Environment - http://www.kde.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+3JlSTQdfac6L/08RAj49AJ9kRr8Thue0mGtTmcfLwLvoCGYofgCgjnbj
cJxKzKvKtkwgLFv1RGCiszA=
=IhVi
-----END PGP SIGNATURE-----
More information about the kde-core-devel
mailing list