kioslave - listDir function (newbie)

Brad Hards bhards at bigpond.net.au
Thu Oct 10 23:27:43 BST 2002


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

On Fri, 11 Oct 2002 00:00, David Faure wrote:
> On Thursday 10 October 2002 15:37, Brad Hards wrote:

> >     atom.m_uds = KIO::UDS_SIZE;
> >     tmp = (*it).mid( 11, 11 );
> >     sscanf(tmp.local8Bit(), "%ld", &val);
>
> Eek. Why not val = tmp.toLong() ?
Ernm, maybe because I'm really a C programmer in a foreign land :-).

I actually went looking for such a function, but couldn't find it in the 
QString docs. 

Fixed.

> >     kdDebug() << "kio_rsync::listDir" << val << endl ;
>
> Does this print the right value?
Always the right value, using the sscanf or .toLong() function.

> > 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.
Bingo!
Well, it took a lot of looking and touching, and some reading of the ftp code, 
but it came down to a single missing entry.clear() on the list.  So I was 
just appending atoms to the same USDEntry, and the first UDS_NAME atom in the 
entry was named "." 

The file size had the same problem of course - it was using the first atom 
that had a size.

Thanks again!

Brad
- -- 
http://linux.conf.au. 22-25Jan2003. Perth, Aust. I'm registered. Are you?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9pf7fW6pHgIdAuOMRAsCFAJ9cc+DGKvq0fvjz1y6YxGrrBiop4gCeJAmc
3u9lXK4JE1nR7QT+LCjF1vQ=
=ngte
-----END PGP SIGNATURE-----





More information about the kfm-devel mailing list