Skip to content

Commit 493d87b

Browse files
committed
Do not create default sync root when loading accounts
Creating the default sync root is only needed at initial setup. If a user chooses to point all folders for Spaces outside that default sync root, and deletes the default sync root folder, it should not be re-created. Fixes: #10919
1 parent 3334529 commit 493d87b

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

changelog/unreleased/10919

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Bugfix: Do not create default sync root when loading accounts
2+
3+
Creating the default sync root is only needed at initial setup. If a
4+
user chooses to point all folders for Spaces outside that default sync
5+
root, and deletes the default sync root folder, it will now no longer be
6+
created.
7+
8+
https://github.com/owncloud/client/issues/10919
9+
https://github.com/owncloud/client/pull/11128

src/gui/folderwizard/folderwizard.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ FolderWizard::Result FolderWizard::result()
215215
if (!d->_account->account()->hasDefaultSyncRoot()) {
216216
if (FileSystem::isChildPathOf(localPath, d->defaultSyncRoot())) {
217217
d->_account->account()->setDefaultSyncRoot(d->defaultSyncRoot());
218+
if (!QFileInfo::exists(d->defaultSyncRoot())) {
219+
OC_ASSERT(QDir().mkpath(d->defaultSyncRoot()));
220+
}
218221
}
219222
}
220223

src/gui/newwizard/setupwizardaccountbuilder.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
#include "gui/accountmanager.h"
1818
#include "networkjobs/fetchuserinfojobfactory.h"
1919

20+
#include <QDir>
21+
#include <QFileInfo>
22+
2023
namespace OCC::Wizard {
2124

2225
AbstractAuthenticationStrategy::~AbstractAuthenticationStrategy() { }
@@ -135,6 +138,9 @@ AccountPtr SetupWizardAccountBuilder::build()
135138

136139
if (!_defaultSyncTargetDir.isEmpty()) {
137140
newAccountPtr->setDefaultSyncRoot(_defaultSyncTargetDir);
141+
if (!QFileInfo::exists(_defaultSyncTargetDir)) {
142+
OC_ASSERT(QDir().mkpath(_defaultSyncTargetDir));
143+
}
138144
}
139145

140146
return newAccountPtr;

src/libsync/account.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,6 @@ void Account::setDefaultSyncRoot(const QString &syncRoot)
354354
Q_ASSERT(_defaultSyncRoot.isEmpty());
355355
if (!syncRoot.isEmpty()) {
356356
_defaultSyncRoot = syncRoot;
357-
if (!QFileInfo::exists(syncRoot)) {
358-
OC_ASSERT(QDir().mkpath(syncRoot));
359-
}
360357
}
361358
}
362359

0 commit comments

Comments
 (0)