Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2020-09-22 12:47:40 +0300
committerHannah von Reth <vonreth@kde.org>2020-09-22 13:31:14 +0300
commit329e20071b7a1e951eaa5520fe1d9f59f6021e4a (patch)
tree30a339a2fd6066afe5d8d025f1f3557a4d2acd58 /src
parentcdac95f1bdf45503e6583d00f6d1104615cab315 (diff)
Use verbose function names instead of direct member access
Diffstat (limited to 'src')
-rw-r--r--src/libsync/owncloudpropagator.cpp24
-rw-r--r--src/libsync/owncloudpropagator.h16
-rw-r--r--src/libsync/propagatedownload.cpp22
-rw-r--r--src/libsync/propagateremotedelete.cpp2
-rw-r--r--src/libsync/propagateremotemkdir.cpp4
-rw-r--r--src/libsync/propagateremotemove.cpp10
-rw-r--r--src/libsync/propagateupload.cpp10
-rw-r--r--src/libsync/propagateuploadng.cpp6
-rw-r--r--src/libsync/propagateuploadtus.cpp6
-rw-r--r--src/libsync/propagateuploadv1.cpp8
-rw-r--r--src/libsync/propagatorjobs.cpp17
-rw-r--r--src/libsync/syncengine.cpp4
12 files changed, 76 insertions, 53 deletions
diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp
index 88b26d9c8..1c53a43cd 100644
--- a/src/libsync/owncloudpropagator.cpp
+++ b/src/libsync/owncloudpropagator.cpp
@@ -590,11 +590,16 @@ bool OwncloudPropagator::hasCaseClashAccessibilityProblem(const QString &relfile
#endif
}
-QString OwncloudPropagator::getFilePath(const QString &tmp_file_name) const
+QString OwncloudPropagator::fullLocalPath(const QString &tmp_file_name) const
{
return _localDir + tmp_file_name;
}
+QString OwncloudPropagator::localPath() const
+{
+ return _localDir;
+}
+
void OwncloudPropagator::scheduleNextJob()
{
if (_jobScheduled) return; // don't schedule more than 1
@@ -671,7 +676,7 @@ OwncloudPropagator::DiskSpaceResult OwncloudPropagator::diskSpaceCheck() const
bool OwncloudPropagator::createConflict(const SyncFileItemPtr &item,
PropagatorCompositeJob *composite, QString *error)
{
- QString fn = getFilePath(item->_file);
+ QString fn = fullLocalPath(item->_file);
QString renameError;
auto conflictModTime = FileSystem::getModTime(fn);
@@ -680,7 +685,7 @@ bool OwncloudPropagator::createConflict(const SyncFileItemPtr &item,
conflictUserName = account()->davDisplayName();
QString conflictFileName = Utility::makeConflictFileName(
item->_file, Utility::qDateTimeFromTime_t(conflictModTime), conflictUserName);
- QString conflictFilePath = getFilePath(conflictFileName);
+ QString conflictFilePath = fullLocalPath(conflictFileName);
emit touchedFile(fn);
emit touchedFile(conflictFilePath);
@@ -987,7 +992,7 @@ void PropagateDirectory::slotSubJobsFinished(SyncFileItem::Status status)
if (_item->_instruction == CSYNC_INSTRUCTION_NEW && _item->_direction == SyncFileItem::Down) {
// special case for local MKDIR, set local directory mtime
// (it's not synced later at all, but can be nice to have it set initially)
- FileSystem::setModTime(propagator()->getFilePath(_item->destination()), _item->_modtime);
+ FileSystem::setModTime(propagator()->fullLocalPath(_item->destination()), _item->_modtime);
}
// For new directories we always want to update the etag once
@@ -1142,4 +1147,15 @@ void CleanupPollsJob::slotPollFinished()
// Continue with the next entry, or finish
start();
}
+
+QString OwncloudPropagator::fullRemotePath(const QString &tmp_file_name) const
+{
+ // TODO: should this be part of the _item (SyncFileItemPtr)?
+ return _remoteFolder + tmp_file_name;
+}
+
+QString OwncloudPropagator::remotePath() const
+{
+ return _remoteFolder;
+}
}
diff --git a/src/libsync/owncloudpropagator.h b/src/libsync/owncloudpropagator.h
index 2c57ea168..dcb588376 100644
--- a/src/libsync/owncloudpropagator.h
+++ b/src/libsync/owncloudpropagator.h
@@ -393,9 +393,6 @@ class OWNCLOUDSYNC_EXPORT OwncloudPropagator : public QObject
{
Q_OBJECT
public:
- const QString _localDir; // absolute path to the local directory. ends with '/'
- const QString _remoteFolder; // remote folder, ends with '/'
-
SyncJournalDb *const _journal;
bool _finishedEmited; // used to ensure that finished is only emitted once
@@ -482,7 +479,15 @@ public:
*/
bool hasCaseClashAccessibilityProblem(const QString &relfile);
- QString getFilePath(const QString &tmp_file_name) const;
+ Q_REQUIRED_RESULT QString fullLocalPath(const QString &tmp_file_name) const;
+ QString localPath() const;
+
+ /**
+ * Returns the full remote path including the folder root of a
+ * folder sync path.
+ */
+ Q_REQUIRED_RESULT QString fullRemotePath(const QString &tmp_file_name) const;
+ QString remotePath() const;
/** Creates the job for an item.
*/
@@ -595,6 +600,9 @@ private:
QScopedPointer<PropagateRootDirectory> _rootJob;
SyncOptions _syncOptions;
bool _jobScheduled = false;
+
+ const QString _localDir; // absolute path to the local directory. ends with '/'
+ const QString _remoteFolder; // remote folder, ends with '/'
};
diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp
index 08b192a17..3c76b3c3e 100644
--- a/src/libsync/propagatedownload.cpp
+++ b/src/libsync/propagatedownload.cpp
@@ -357,7 +357,7 @@ void PropagateDownloadFile::start()
// For virtual files just dehydrate or create the file and be done
if (_item->_type == ItemTypeVirtualFileDehydration) {
- QString fsPath = propagator()->getFilePath(_item->_file);
+ QString fsPath = propagator()->fullLocalPath(_item->_file);
if (!FileSystem::verifyFileUnchanged(fsPath, _item->_previousSize, _item->_previousModtime)) {
propagator()->_anotherSyncNeeded = true;
done(SyncFileItem::SoftError, tr("File has changed since discovery"));
@@ -414,7 +414,7 @@ void PropagateDownloadFile::start()
connect(computeChecksum, &ComputeChecksum::done,
this, &PropagateDownloadFile::conflictChecksumComputed);
propagator()->_activeJobList.append(this);
- computeChecksum->start(propagator()->getFilePath(_item->_file));
+ computeChecksum->start(propagator()->fullLocalPath(_item->_file));
return;
}
@@ -430,7 +430,7 @@ void PropagateDownloadFile::conflictChecksumComputed(const QByteArray &checksumT
// Apply the server mtime locally if necessary, ensuring the journal
// and local mtimes end up identical
- auto fn = propagator()->getFilePath(_item->_file);
+ auto fn = propagator()->fullLocalPath(_item->_file);
if (_item->_modtime != _item->_previousModtime) {
FileSystem::setModTime(fn, _item->_modtime);
emit propagator()->touchedFile(fn);
@@ -460,7 +460,7 @@ void PropagateDownloadFile::startDownload()
if (progressInfo._valid) {
// if the etag has changed meanwhile, remove the already downloaded part.
if (progressInfo._etag != _item->_etag) {
- FileSystem::remove(propagator()->getFilePath(progressInfo._tmpfile));
+ FileSystem::remove(propagator()->fullLocalPath(progressInfo._tmpfile));
propagator()->_journal->setDownloadInfo(_item->_file, SyncJournalDb::DownloadInfo());
} else {
tmpFileName = progressInfo._tmpfile;
@@ -471,7 +471,7 @@ void PropagateDownloadFile::startDownload()
if (tmpFileName.isEmpty()) {
tmpFileName = createDownloadTmpFileName(_item->_file);
}
- _tmpFile.setFileName(propagator()->getFilePath(tmpFileName));
+ _tmpFile.setFileName(propagator()->fullLocalPath(tmpFileName));
_resumeStart = _tmpFile.size();
if (_resumeStart > 0 && _resumeStart == _item->_size) {
@@ -534,7 +534,7 @@ void PropagateDownloadFile::startFullDownload()
if (_item->_directDownloadUrl.isEmpty()) {
// Normal job, download from oC instance
_job = new GETFileJob(propagator()->account(),
- propagator()->_remoteFolder + _item->_file,
+ propagator()->fullRemotePath(_item->_file),
&_tmpFile, headers, _expectedEtagForResume, _resumeStart, this);
} else {
// We were provided a direct URL, use that one
@@ -751,7 +751,7 @@ void PropagateDownloadFile::slotChecksumFail(const QString &errMsg)
void PropagateDownloadFile::deleteExistingFolder()
{
- QString existingDir = propagator()->getFilePath(_item->_file);
+ QString existingDir = propagator()->fullLocalPath(_item->_file);
if (!QFileInfo(existingDir).isDir()) {
return;
}
@@ -876,7 +876,7 @@ void PropagateDownloadFile::contentChecksumComputed(const QByteArray &checksumTy
void PropagateDownloadFile::downloadFinished()
{
OC_ASSERT(!_tmpFile.isOpen());
- QString fn = propagator()->getFilePath(_item->_file);
+ QString fn = propagator()->fullLocalPath(_item->_file);
// In case of file name clash, report an error
// This can happen if another parallel download saved a clashing file.
@@ -965,7 +965,7 @@ void PropagateDownloadFile::downloadFinished()
// entry, remove it transfer its old pin state.
if (_item->_type == ItemTypeVirtualFileDownload) {
QString virtualFile = _item->_file + vfs->fileSuffix();
- auto fn = propagator()->getFilePath(virtualFile);
+ auto fn = propagator()->fullLocalPath(virtualFile);
qCDebug(lcPropagateDownload) << "Download of previous virtual file finished" << fn;
QFile::remove(fn);
propagator()->_journal->deleteFileRecord(virtualFile);
@@ -989,7 +989,7 @@ void PropagateDownloadFile::downloadFinished()
void PropagateDownloadFile::updateMetadata(bool isConflict)
{
- QString fn = propagator()->getFilePath(_item->_file);
+ QString fn = propagator()->fullLocalPath(_item->_file);
if (!propagator()->updateMetadata(*_item)) {
done(SyncFileItem::FatalError, tr("Error writing metadata to the database"));
@@ -1004,7 +1004,7 @@ void PropagateDownloadFile::updateMetadata(bool isConflict)
if (!_item->_remotePerm.hasPermission(RemotePermissions::IsShared)
&& (_item->_file == QLatin1String(".sys.admin#recall#")
|| _item->_file.endsWith(QLatin1String("/.sys.admin#recall#")))) {
- handleRecallFile(fn, propagator()->_localDir, *propagator()->_journal);
+ handleRecallFile(fn, propagator()->localPath(), *propagator()->_journal);
}
qint64 duration = _stopwatch.elapsed();
diff --git a/src/libsync/propagateremotedelete.cpp b/src/libsync/propagateremotedelete.cpp
index 17c467b50..ed71aee73 100644
--- a/src/libsync/propagateremotedelete.cpp
+++ b/src/libsync/propagateremotedelete.cpp
@@ -67,7 +67,7 @@ void PropagateRemoteDelete::start()
qCDebug(lcPropagateRemoteDelete) << _item->_file;
_job = new DeleteJob(propagator()->account(),
- propagator()->_remoteFolder + _item->_file,
+ propagator()->fullRemotePath(_item->_file),
this);
connect(_job.data(), &DeleteJob::finishedSignal, this, &PropagateRemoteDelete::slotDeleteJobFinished);
propagator()->_activeJobList.append(this);
diff --git a/src/libsync/propagateremotemkdir.cpp b/src/libsync/propagateremotemkdir.cpp
index a601b23f5..5faa2f44b 100644
--- a/src/libsync/propagateremotemkdir.cpp
+++ b/src/libsync/propagateremotemkdir.cpp
@@ -40,7 +40,7 @@ void PropagateRemoteMkdir::start()
}
_job = new DeleteJob(propagator()->account(),
- propagator()->_remoteFolder + _item->_file,
+ propagator()->fullRemotePath(_item->_file),
this);
connect(_job, SIGNAL(finishedSignal()), SLOT(slotStartMkcolJob()));
_job->start();
@@ -54,7 +54,7 @@ void PropagateRemoteMkdir::slotStartMkcolJob()
qCDebug(lcPropagateRemoteMkdir) << _item->_file;
_job = new MkColJob(propagator()->account(),
- propagator()->_remoteFolder + _item->_file,
+ propagator()->fullRemotePath(_item->_file),
this);
connect(_job, SIGNAL(finished(QNetworkReply::NetworkError)), this, SLOT(slotMkcolJobFinished()));
_job->start();
diff --git a/src/libsync/propagateremotemove.cpp b/src/libsync/propagateremotemove.cpp
index 758b6e94a..7f45eb050 100644
--- a/src/libsync/propagateremotemove.cpp
+++ b/src/libsync/propagateremotemove.cpp
@@ -81,7 +81,7 @@ void PropagateRemoteMove::start()
QString origin = propagator()->adjustRenamedPath(_item->_file);
qCDebug(lcPropagateRemoteMove) << origin << _item->_renameTarget;
- QString targetFile(propagator()->getFilePath(_item->_renameTarget));
+ QString targetFile(propagator()->fullLocalPath(_item->_renameTarget));
if (origin == _item->_renameTarget) {
// The parent has been renamed already so there is nothing more to do.
@@ -89,8 +89,8 @@ void PropagateRemoteMove::start()
return;
}
- QString remoteSource = propagator()->_remoteFolder + origin;
- QString remoteDestination = QDir::cleanPath(propagator()->account()->davUrl().path() + propagator()->_remoteFolder + _item->_renameTarget);
+ QString remoteSource = propagator()->fullRemotePath(origin);
+ QString remoteDestination = QDir::cleanPath(propagator()->account()->davUrl().path() + propagator()->fullRemotePath(_item->_renameTarget));
auto &vfs = propagator()->syncOptions()._vfs;
auto itype = _item->_type;
@@ -130,8 +130,8 @@ void PropagateRemoteMove::start()
folderTargetAlt.chop(suffix.size());
}
- QString localTarget = propagator()->getFilePath(folderTarget);
- QString localTargetAlt = propagator()->getFilePath(folderTargetAlt);
+ QString localTarget = propagator()->fullLocalPath(folderTarget);
+ QString localTargetAlt = propagator()->fullLocalPath(folderTargetAlt);
// If the expected target doesn't exist but a file with different hydration
// state does, rename the local file to bring it in line with what the discovery
diff --git a/src/libsync/propagateupload.cpp b/src/libsync/propagateupload.cpp
index 7604bdbf0..661f37928 100644
--- a/src/libsync/propagateupload.cpp
+++ b/src/libsync/propagateupload.cpp
@@ -217,7 +217,7 @@ void PropagateUploadFileCommon::start()
}
auto job = new DeleteJob(propagator()->account(),
- propagator()->_remoteFolder + _item->_file,
+ propagator()->fullRemotePath(_item->_file),
this);
_jobs.append(job);
connect(job, &DeleteJob::finishedSignal, this, &PropagateUploadFileCommon::slotComputeContentChecksum);
@@ -231,7 +231,7 @@ void PropagateUploadFileCommon::slotComputeContentChecksum()
return;
}
- const QString filePath = propagator()->getFilePath(_item->_file);
+ const QString filePath = propagator()->fullLocalPath(_item->_file);
// remember the modtime before checksumming to be able to detect a file
// change during the checksum calculation
@@ -282,7 +282,7 @@ void PropagateUploadFileCommon::slotComputeTransmissionChecksum(const QByteArray
this, &PropagateUploadFileCommon::slotStartUpload);
connect(computeChecksum, &ComputeChecksum::done,
computeChecksum, &QObject::deleteLater);
- const QString filePath = propagator()->getFilePath(_item->_file);
+ const QString filePath = propagator()->fullLocalPath(_item->_file);
computeChecksum->start(filePath);
}
@@ -299,7 +299,7 @@ void PropagateUploadFileCommon::slotStartUpload(const QByteArray &transmissionCh
_item->_checksumHeader = _transmissionChecksumHeader;
}
- const QString fullFilePath = propagator()->getFilePath(_item->_file);
+ const QString fullFilePath = propagator()->fullLocalPath(_item->_file);
if (!FileSystem::fileExists(fullFilePath)) {
done(SyncFileItem::SoftError, tr("File Removed"));
@@ -487,7 +487,7 @@ void UploadDevice::setChoked(bool b)
void PropagateUploadFileCommon::startPollJob(const QString &path)
{
PollJob *job = new PollJob(propagator()->account(), path, _item,
- propagator()->_journal, propagator()->_localDir, this);
+ propagator()->_journal, propagator()->localPath(), this);
connect(job, &PollJob::finishedSignal, this, &PropagateUploadFileCommon::slotPollFinished);
SyncJournalDb::PollInfo info;
info._file = _item->_file;
diff --git a/src/libsync/propagateuploadng.cpp b/src/libsync/propagateuploadng.cpp
index ed2d07bfb..ac69699c6 100644
--- a/src/libsync/propagateuploadng.cpp
+++ b/src/libsync/propagateuploadng.cpp
@@ -327,7 +327,7 @@ void PropagateUploadFileNG::doFinalMove()
// Finish with a MOVE
QString destination = QDir::cleanPath(propagator()->account()->davUrl().path()
- + propagator()->_remoteFolder + _item->_file);
+ + propagator()->fullRemotePath(_item->_file));
auto headers = PropagateUploadFileCommon::headers();
// "If-Match applies to the source, but we are interested in comparing the etag of the destination
@@ -369,7 +369,7 @@ void PropagateUploadFileNG::startNextChunk()
_currentChunkOffset = _rangesToUpload.first().start;
_currentChunkSize = qMin(propagator()->_chunkSize, _rangesToUpload.first().size);
- const QString fileName = propagator()->getFilePath(_item->_file);
+ const QString fileName = propagator()->fullLocalPath(_item->_file);
auto device = std::unique_ptr<UploadDevice>(new UploadDevice(
fileName, _currentChunkOffset, _currentChunkSize, &propagator()->_bandwidthManager));
@@ -466,7 +466,7 @@ void PropagateUploadFileNG::slotPutFinished()
_finished = _sent == _bytesToUpload;
// Check if the file still exists
- const QString fullFilePath(propagator()->getFilePath(_item->_file));
+ const QString fullFilePath(propagator()->fullLocalPath(_item->_file));
if (!FileSystem::fileExists(fullFilePath)) {
if (!_finished) {
abortWithError(SyncFileItem::SoftError, tr("The local file was removed during sync."));
diff --git a/src/libsync/propagateuploadtus.cpp b/src/libsync/propagateuploadtus.cpp
index f324c3dc6..1efa3ff8b 100644
--- a/src/libsync/propagateuploadtus.cpp
+++ b/src/libsync/propagateuploadtus.cpp
@@ -58,7 +58,7 @@ Q_LOGGING_CATEGORY(lcPropagateUploadTUS, "sync.propagator.upload.tus", QtDebugMs
UploadDevice *PropagateUploadFileTUS::prepareDevice(const quint64 &chunkSize)
{
- const QString localFileName = propagator()->getFilePath(_item->_file);
+ const QString localFileName = propagator()->fullLocalPath(_item->_file);
auto device = new UploadDevice(localFileName, _currentOffset, chunkSize, &propagator()->_bandwidthManager);
if (!device->open(QIODevice::ReadOnly)) {
qCWarning(lcPropagateUploadTUS) << "Could not prepare upload device: " << device->errorString();
@@ -81,7 +81,7 @@ SimpleNetworkJob *PropagateUploadFileTUS::makeCreationWithUploadJob(QNetworkRequ
Q_ASSERT(propagator()->account()->capabilities().tusSupport().extensions.contains(QStringLiteral("creation-with-upload")));
// in difference to the old protocol the algrithm and the value are space seperated
const auto checkSum = _transmissionChecksumHeader.replace(':', ' ').toBase64();
- const QString filePath = propagator()->_remoteFolder + _item->_file;
+ const QString filePath = propagator()->fullRemotePath(_item->_file);
qCDebug(lcPropagateUploadTUS) << "FullPath:" << filePath;
request->setRawHeader(QByteArrayLiteral("Upload-Metadata"), "filename " + filePath.toUtf8().toBase64() + ",checksum " + checkSum);
request->setRawHeader(QByteArrayLiteral("Upload-Length"), QByteArray::number(_item->_size));
@@ -199,7 +199,7 @@ void PropagateUploadFileTUS::slotChunkFinished()
_finished = offset == _item->_size;
// Check if the file still exists
- const QString fullFilePath(propagator()->getFilePath(_item->_file));
+ const QString fullFilePath(propagator()->fullLocalPath(_item->_file));
if (!FileSystem::fileExists(fullFilePath)) {
if (!_finished) {
abortWithError(SyncFileItem::SoftError, tr("The local file was removed during sync."));
diff --git a/src/libsync/propagateuploadv1.cpp b/src/libsync/propagateuploadv1.cpp
index 7c2dd27eb..c7ecc5c8a 100644
--- a/src/libsync/propagateuploadv1.cpp
+++ b/src/libsync/propagateuploadv1.cpp
@@ -124,11 +124,11 @@ void PropagateUploadFileV1::startNextChunk()
qCDebug(lcPropagateUploadV1) << _chunkCount << isFinalChunk << chunkStart << currentChunkSize;
if (isFinalChunk && !_transmissionChecksumHeader.isEmpty()) {
- qCInfo(lcPropagateUploadV1) << propagator()->_remoteFolder + path << _transmissionChecksumHeader;
+ qCInfo(lcPropagateUploadV1) << propagator()->fullRemotePath(path) << _transmissionChecksumHeader;
headers[checkSumHeaderC] = _transmissionChecksumHeader;
}
- const QString fileName = propagator()->getFilePath(_item->_file);
+ const QString fileName = propagator()->fullLocalPath(_item->_file);
auto device = std::unique_ptr<UploadDevice>(new UploadDevice(
fileName, chunkStart, currentChunkSize, &propagator()->_bandwidthManager));
if (!device->open(QIODevice::ReadOnly)) {
@@ -146,7 +146,7 @@ void PropagateUploadFileV1::startNextChunk()
// job takes ownership of device via a QScopedPointer. Job deletes itself when finishing
auto devicePtr = device.get(); // for connections later
- PUTFileJob *job = new PUTFileJob(propagator()->account(), propagator()->_remoteFolder + path, std::move(device), headers, _currentChunk, this);
+ PUTFileJob *job = new PUTFileJob(propagator()->account(), propagator()->fullRemotePath(path), std::move(device), headers, _currentChunk, this);
_jobs.append(job);
connect(job, &PUTFileJob::finishedSignal, this, &PropagateUploadFileV1::slotPutFinished);
connect(job, &PUTFileJob::uploadProgress, this, &PropagateUploadFileV1::slotUploadProgress);
@@ -241,7 +241,7 @@ void PropagateUploadFileV1::slotPutFinished()
_finished = etag.length() > 0;
// Check if the file still exists
- const QString fullFilePath(propagator()->getFilePath(_item->_file));
+ const QString fullFilePath(propagator()->fullLocalPath(_item->_file));
if (!FileSystem::fileExists(fullFilePath)) {
if (!_finished) {
abortWithError(SyncFileItem::SoftError, tr("The local file was removed during sync."));
diff --git a/src/libsync/propagatorjobs.cpp b/src/libsync/propagatorjobs.cpp
index fc74f5f54..3e926588b 100644
--- a/src/libsync/propagatorjobs.cpp
+++ b/src/libsync/propagatorjobs.cpp
@@ -54,8 +54,7 @@ QByteArray localFileIdFromFullId(const QByteArray &id)
*/
bool PropagateLocalRemove::removeRecursively(const QString &path)
{
- auto folderDir = propagator()->_localDir;
- QString absolute = folderDir + _item->_file + path;
+ QString absolute = propagator()->fullLocalPath(_item->_file + path);
QStringList errors;
QList<QPair<QString, bool>> deleted;
bool success = FileSystem::removeRecursively(
@@ -71,14 +70,14 @@ bool PropagateLocalRemove::removeRecursively(const QString &path)
// Do it while avoiding redundant delete calls to the journal.
QString deletedDir;
foreach (const auto &it, deleted) {
- if (!it.first.startsWith(folderDir))
+ if (!it.first.startsWith(propagator()->localPath()))
continue;
if (!deletedDir.isEmpty() && it.first.startsWith(deletedDir))
continue;
if (it.second) {
deletedDir = it.first;
}
- propagator()->_journal->deleteFileRecord(it.first.mid(folderDir.size()), it.second);
+ propagator()->_journal->deleteFileRecord(it.first.mid(propagator()->localPath().size()), it.second);
}
_error = errors.join(QStringLiteral(", "));
@@ -93,7 +92,7 @@ void PropagateLocalRemove::start()
if (propagator()->_abortRequested)
return;
- QString filename = propagator()->_localDir + _item->_file;
+ const QString filename = propagator()->fullLocalPath(_item->_file);
qCDebug(lcPropagateLocalRemove) << filename;
if (propagator()->localFileNameClash(_item->_file)) {
@@ -133,7 +132,7 @@ void PropagateLocalMkdir::start()
if (propagator()->_abortRequested)
return;
- QDir newDir(propagator()->getFilePath(_item->_file));
+ QDir newDir(propagator()->fullLocalPath(_item->_file));
QString newDirStr = QDir::toNativeSeparators(newDir.path());
// When turning something that used to be a file into a directory
@@ -163,7 +162,7 @@ void PropagateLocalMkdir::start()
return;
}
emit propagator()->touchedFile(newDirStr);
- QDir localDir(propagator()->_localDir);
+ QDir localDir(propagator()->localPath());
if (!localDir.mkpath(_item->_file)) {
done(SyncFileItem::NormalError, tr("could not create folder %1").arg(newDirStr));
return;
@@ -198,8 +197,8 @@ void PropagateLocalRename::start()
if (propagator()->_abortRequested)
return;
- QString existingFile = propagator()->getFilePath(propagator()->adjustRenamedPath(_item->_file));
- QString targetFile = propagator()->getFilePath(_item->_renameTarget);
+ QString existingFile = propagator()->fullLocalPath(propagator()->adjustRenamedPath(_item->_file));
+ QString targetFile = propagator()->fullLocalPath(_item->_renameTarget);
// if the file is a file underneath a moved dir, the _item->file is equal
// to _item->renameTarget and the file is not moved as a result.
diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp
index 046172c1d..423cd6dd6 100644
--- a/src/libsync/syncengine.cpp
+++ b/src/libsync/syncengine.cpp
@@ -216,7 +216,7 @@ void SyncEngine::deleteStaleDownloadInfos(const SyncFileItemVector &syncItems)
const QVector<SyncJournalDb::DownloadInfo> deleted_infos =
_journal->getAndDeleteStaleDownloadInfos(download_file_paths);
foreach (const SyncJournalDb::DownloadInfo &deleted_info, deleted_infos) {
- const QString tmppath = _propagator->getFilePath(deleted_info._tmpfile);
+ const QString tmppath = _propagator->fullLocalPath(deleted_info._tmpfile);
qCInfo(lcEngine) << "Deleting stale temporary file: " << tmppath;
FileSystem::remove(tmppath);
}
@@ -268,7 +268,7 @@ void SyncEngine::conflictRecordMaintenance()
// missing ones.
auto conflictRecordPaths = _journal->conflictRecordPaths();
for (const auto &path : conflictRecordPaths) {
- auto fsPath = _propagator->getFilePath(QString::fromUtf8(path));
+ auto fsPath = _propagator->fullLocalPath(QString::fromUtf8(path));
if (!QFileInfo(fsPath).exists()) {
_journal->deleteConflictRecord(path);
}