kioslave - listDir function (newbie)

David Faure david at mandrakesoft.com
Thu Oct 10 15:00:50 BST 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thursday 10 October 2002 15:37, Brad Hards wrote:
> On Thu, 10 Oct 2002 08:01, Brad Hards wrote:
> > On Wed, 9 Oct 2002 18:56, David Faure wrote:
> > > Your stat() implementation looks fine, but if you want to see entries in
> > > a directory listing, you need to implement listDir().
> >
> > Thanks. Now implemented, and my trivial example is now ready for expansion
> > to do something useful :)
> OK, I'm now parsing the output from rsync. It basically looks like:
> drwxr-sr-x        4096 2002/04/10 16:42:23 .
> -rw-r--r--         159 2002/03/13 11:24:30 .message
> -rw-r--r--       17982 1997/12/27 15:26:26 COPYING
> -r--r--r--        1320 2002/04/02 12:12:12 NEWS
> -rw-r--r--        7211 2002/01/03 18:19:51 README
> drwxr-sr-x        4096 2001/10/16 00:59:19 binaries
> -rw-r--r--      466705 2002/01/03 18:20:36 cvs.log

Looks simpler than what kio_ftp has to parse ;)
Well, assuming dates are always written that way.
You might want to look at the parsing code in kio_ftp btw.

>     atom.m_uds = KIO::UDS_SIZE;
>     tmp = (*it).mid( 11, 11 );
>     sscanf(tmp.local8Bit(), "%ld", &val);
Eek. Why not val = tmp.toLong() ?

>     kdDebug() << "kio_rsync::listDir" << val << endl ;
Does this print the right value?

> It only works with something on the end (or beginning) of the filename. Of
> course, that completely breaks the directory system.  If I don't have that
> space, I'm hitting the assert  ( Q_ASSERT( !dir->rootItem ) ) in
> kdirlister.cpp (line 802).

Make sure you emit an item named "."  (with no space or anything else after it!),
as a directory. That's the root item the dirlister is looking for.
But also make sure to only emit ONE such item.
It looks like you're emitting more than one, since you hit that assert.

> I'm confused as to what this is missing. What does the listDir function need
> to provide, except for listEntry's? I tried adding a dummy ".." type entry -
No, no, no ".." entry!

> If that wasn't enough, I'm also getting the same size for every file: see
> http://www.cuneata.net/rsync-kio.html for an example (with the space hack).
The sprintf looks guilty to me, please try toLong().

- -- 
David FAURE, david at mandrakesoft.com, faure at kde.org
http://people.mandrakesoft.com/~david/
Contributing to: http://www.konqueror.org/, http://www.koffice.org/
Get the latest KOffice - http://download.kde.org/stable/koffice-1.2/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9pYgT72KcVAmwbhARAvsDAJ4/tsQgIraSbLiOGQWkFjC3ODzE+ACfXUB+
CphVDmOn0KeBeocYGO/30dg=
=YnBk
-----END PGP SIGNATURE-----





More information about the kfm-devel mailing list