More progress on the CI problem detection.

This commit is contained in:
Klaas Freitag 2014-05-22 17:12:59 +02:00
parent 1303379c9e
commit 7e8b403116
2 changed files with 28 additions and 1 deletions

View File

@ -99,6 +99,32 @@ void PropagateLocalRemove::start()
done(SyncFileItem::Success);
}
bool PropagateLocalMkdir::hasCaseClash( const QString& file )
{
bool re = false;
qDebug() << "CaseClashCheck for " << file;
#ifdef Q_OS_WIN
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
hFind = FindFirstFileW( (wchar_t*)file.utf16(), &FindFileData);
if (hFind == INVALID_HANDLE_VALUE) {
qDebug() << "FindFirstFile failed " << GetLastError();
// returns false.
} else {
QString realFileName = QString::fromWCharArray( FindFileData.cFileName );
qDebug() << Q_FUNC_INFO << "Real file name is " << realFileName;
FindClose(hFind);
if( ! file.endsWith(realFileName, Qt::CaseSensitive) ) {
re = true;
}
}
#endif
return re;
}
void PropagateLocalMkdir::start()
{
if (_propagator->_abortRequested.fetchAndAddRelaxed(0))
@ -106,7 +132,7 @@ void PropagateLocalMkdir::start()
QDir newDir(_propagator->_localDir + _item._file);
QString newDirStr = QDir::toNativeSeparators(newDir.path());
if(newDir.exists()) {
if(newDir.exists() && hasCaseClash(_propagator->_localDir + _item._file ) ) { // add a check on the file name
qDebug() << "WARN: new directory to create locally already exists!";
done( SyncFileItem::NormalError, tr("Attention, possible case sensitivity clash with %1").arg(newDirStr) );
return;

View File

@ -81,6 +81,7 @@ class PropagateLocalMkdir : public PropagateItemJob {
public:
PropagateLocalMkdir (OwncloudPropagator* propagator,const SyncFileItem& item) : PropagateItemJob(propagator, item) {}
void start();
bool hasCaseClash( const QString& file );
};
class PropagateRemoteRemove : public PropagateNeonJob {
Q_OBJECT