mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Added method localFileNameClash
Also reordered the implementations a bit.
This commit is contained in:
parent
ea9f302b7a
commit
57359968ed
@ -21,6 +21,11 @@
|
||||
#include "propagator_legacy.h"
|
||||
#include "mirall/utility.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#endif
|
||||
|
||||
#include <QStack>
|
||||
|
||||
namespace Mirall {
|
||||
@ -153,6 +158,8 @@ void PropagateItemJob::slotRestoreJobCompleted(const SyncFileItem& item )
|
||||
}
|
||||
}
|
||||
|
||||
// ================================================================================
|
||||
|
||||
PropagateItemJob* OwncloudPropagator::createJob(const SyncFileItem& item) {
|
||||
switch(item._instruction) {
|
||||
case CSYNC_INSTRUCTION_REMOVE:
|
||||
@ -281,6 +288,45 @@ bool OwncloudPropagator::useLegacyJobs()
|
||||
return env=="true" || env =="1";
|
||||
}
|
||||
|
||||
int OwncloudPropagator::httpTimeout()
|
||||
{
|
||||
static int timeout;
|
||||
if (!timeout) {
|
||||
timeout = qgetenv("OWNCLOUD_TIMEOUT").toUInt();
|
||||
if (timeout == 0) {
|
||||
timeout = 300; // default to 300 secs
|
||||
}
|
||||
}
|
||||
return timeout;
|
||||
}
|
||||
|
||||
bool OwncloudPropagator::localFileNameClash( const QString& relFile )
|
||||
{
|
||||
bool re = false;
|
||||
const QString file( _localDir + relFile );
|
||||
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 PropagateDirectory::start()
|
||||
{
|
||||
@ -339,17 +385,4 @@ void PropagateDirectory::slotSubJobReady()
|
||||
}
|
||||
}
|
||||
|
||||
int OwncloudPropagator::httpTimeout()
|
||||
{
|
||||
static int timeout;
|
||||
if (!timeout) {
|
||||
timeout = qgetenv("OWNCLOUD_TIMEOUT").toUInt();
|
||||
if (timeout == 0) {
|
||||
timeout = 300; // default to 300 secs
|
||||
}
|
||||
}
|
||||
return timeout;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -211,6 +211,7 @@ public:
|
||||
int _activeJobs;
|
||||
|
||||
bool isInSharedDirectory(const QString& file);
|
||||
bool localFileNameClash(const QString& relfile);
|
||||
|
||||
void abort() {
|
||||
_abortRequested.fetchAndStoreOrdered(true);
|
||||
|
||||
@ -81,7 +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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user