Case clash check for local remove plus native separators.

This commit is contained in:
Klaas Freitag 2014-05-26 18:17:18 +02:00
parent f1b2417967
commit 6017eb7ca6

View file

@ -76,9 +76,16 @@ void PropagateLocalRemove::start()
return; return;
QString filename = _propagator->_localDir + _item._file; QString filename = _propagator->_localDir + _item._file;
if( _propagator->localFileNameClash(_item._file)) {
done(SyncFileItem::NormalError, tr("Could not remove %1 because of a local file name clash")
.arg(QDir::toNativeSeparators(filename)));
return;
}
if (_item._isDirectory) { if (_item._isDirectory) {
if (QDir(filename).exists() && !removeRecursively(filename)) { if (QDir(filename).exists() && !removeRecursively(filename)) {
done(SyncFileItem::NormalError, tr("Could not remove directory %1").arg(filename)); done(SyncFileItem::NormalError, tr("Could not remove directory %1")
.arg(QDir::toNativeSeparators(filename)));
return; return;
} }
} else { } else {
@ -187,7 +194,7 @@ void PropagateLocalRename::start()
// Fixme: the file that is the reason for the clash could be named here, // Fixme: the file that is the reason for the clash could be named here,
// it would have to come out the localFileNameClash function // it would have to come out the localFileNameClash function
done(SyncFileItem::NormalError, tr( "File %1 can not be renamed to %2 because of a local file name clash") done(SyncFileItem::NormalError, tr( "File %1 can not be renamed to %2 because of a local file name clash")
.arg(_item._file).arg(_item._renameTarget) ); .arg(QDir::toNativeSeparators(_item._file)).arg(QDir::toNativeSeparators(_item._renameTarget)) );
return; return;
} }
if (!file.rename(_propagator->_localDir + _item._file, _propagator->_localDir + _item._renameTarget)) { if (!file.rename(_propagator->_localDir + _item._file, _propagator->_localDir + _item._renameTarget)) {