KIO errors (CVS HEAD)
amantia at kde.org
Mon Jun 14 16:19:40 BST 2004
Today I encountered two KIO::NetAccess errors. The first one is with
download (but affects file_copy as well), the second is with file_copy.
The problem with the first one is that if you do the following:
KIO::NetAccess::download(absUrl, tmp, this);
kdDebug(24000) << "Cannot open: " << f.name() << ". The error
was: " << f.errorString() << endl;
From time to time you will see that the file cannot be opened, and the
error is "No such file or directory".
I've tried to workaround the above by using:
KTempFile *tempFile = new KTempFile(tmpDir);
tempFile->close(); (tried also without this line)
KURL tmpURL = KURL::fromPathOrURL(tempFile->name());
KIO::NetAccess::file_copy(absUrl, tmpURL, -1, true, true, this);
kdDebug(24000) << "Cannot open: " << f.name() << ". The error was:
" << f.errorString() << endl;
The result is the same. Sometimes the file cannot be opened. An ugly
int k = 0;
while (!f.exists() && k < 1000000) k++;
before f.open() usually helps.
The second problem appears with the second example. If the above code is
called for many files (but using the same temporary file, so the part
between //loop begin and //loop end is put inside a loop), from time to
time I get a "file exist, do you want to overwrite" dialog. Note that
"overwrite = true" above... I've even tried an f.remove() after
I think the problem is somewhere deeper in the code. Oh, I forgot, I've
used the FTP protocol here. With fish it just hangs sometime. sftp
seems to be OK regarding both bugs. So what can be the problem here?
I need the following to work as there are some classes that does not
work with remote files (QDomDocument, KMD5) and to be network
transparent first I need to download the files to a temporary location.
Quanta Plus developer - http://quanta.sourceforge.net
K Desktop Environment - http://www.kde.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
More information about the kde-core-devel