mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
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
This commit is contained in:
parent
b9ea7c3414
commit
4ceee86c66
@ -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));
|
||||
|
||||
|
||||
@ -33,13 +33,6 @@ SyncJournalDb::SyncJournalDb(const QString& path, QObject *parent) :
|
||||
QObject(parent), _transaction(0)
|
||||
{
|
||||
|
||||
_dbFile = path;
|
||||
if( !_dbFile.endsWith('/') ) {
|
||||
_dbFile.append('/');
|
||||
}
|
||||
_dbFile.append(".csync_journal.db");
|
||||
|
||||
|
||||
}
|
||||
|
||||
bool SyncJournalDb::exists()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user