mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
FileName::destroyDirectory(): Continue deleting even if if a delete operation failed.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21795 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d3f0a07af7
commit
d918eac0d1
@ -239,25 +239,32 @@ static bool rmdir(QFileInfo const & fi)
|
||||
{
|
||||
QDir dir(fi.absoluteFilePath());
|
||||
QFileInfoList list = dir.entryInfoList();
|
||||
bool global_success = true;
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
if (list.at(i).fileName() == ".")
|
||||
continue;
|
||||
if (list.at(i).fileName() == "..")
|
||||
continue;
|
||||
bool success;
|
||||
if (list.at(i).isDir()) {
|
||||
LYXERR(Debug::FILES, "Erasing dir "
|
||||
<< fromqstr(list.at(i).absoluteFilePath()) << endl);
|
||||
if (!rmdir(list.at(i)))
|
||||
return false;
|
||||
success = rmdir(list.at(i));
|
||||
}
|
||||
else {
|
||||
LYXERR(Debug::FILES, "Erasing file "
|
||||
<< fromqstr(list.at(i).absoluteFilePath()) << endl);
|
||||
dir.remove(list.at(i).fileName());
|
||||
success = dir.remove(list.at(i).fileName());
|
||||
}
|
||||
if (!success) {
|
||||
global_success = false;
|
||||
lyxerr << "Could not delete "
|
||||
<< fromqstr(list.at(i).absoluteFilePath()) << "." << endl;
|
||||
}
|
||||
}
|
||||
QDir parent = fi.absolutePath();
|
||||
return parent.rmdir(fi.fileName());
|
||||
global_success |= parent.rmdir(fi.fileName());
|
||||
return global_success;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user