SyncEngine: Calculate a uniq journal name using the remote account.

That should allow to sync the same local folder to multiple remote destinations.

see #3764
Esse commit está contido em:
Klaas Freitag
2016-07-10 12:56:43 +02:00
commit 4ceee86c66
2 arquivos alterados com 13 adições e 8 exclusões
+13 -1
Ver Arquivo
@@ -90,8 +90,20 @@ SyncEngine::SyncEngine(AccountPtr account, const QString& localPath,
#endif
url_string = Utility::toCSyncScheme(url_string);
// localPath always has a trailing slash
QString dbFile = localPath;
dbFile.append( QLatin1String(".csync_"));
// FIXME: Make sure this remoteUrlPath is equal to the one calculated in FolderMan::ensureJournalGone
// FIXME: Maybe it is better to only allow different hosts, without path component.
QString remoteUrlPath = _remoteUrl.toString()+_remotePath;
QByteArray ba = QCryptographicHash::hash( remoteUrlPath.toUtf8(), QCryptographicHash::Md5);
dbFile.append( ba.left(6).toHex() );
_journal->setDatabaseFilePath(dbFile);
csync_create(&_csync_ctx, localPath.toUtf8().data(), url_string.toUtf8().data());
csync_init(_csync_ctx);
csync_init(_csync_ctx, dbFile.toUtf8().data());
_excludedFiles.reset(new ExcludedFiles(&_csync_ctx->excludes));
_syncFileStatusTracker.reset(new SyncFileStatusTracker(this));