Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: Enable us to support sync root path > 260 char #10135

Merged
merged 2 commits into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/10135
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Allow creation of sync roots with long paths

Until now, we were only able to create a .sync_journal.db in a path with less than 260 characters.

https://github.com/owncloud/client/pull/10135/
11 changes: 10 additions & 1 deletion src/common/ownsql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
#include <QString>

#include "common/asserts.h"
#include "common/filesystembase.h"
#include "common/utility.h"

#include "ownsql.h"

#include <sqlite3.h>
Expand Down Expand Up @@ -77,7 +79,14 @@ bool SqlDatabase::openHelper(const QString &filename, int sqliteFlags)

sqliteFlags |= SQLITE_OPEN_NOMUTEX;

SQLITE_DO(sqlite3_open_v2(filename.toUtf8().constData(), &_db, sqliteFlags, nullptr));
#ifdef Q_OS_WIN
// allow file paths > 260
// https://www.sqlite.org/vfs.html#standard_windows_vfses
char *vfs = "win32-longpath";
#else
char *vfs = nullptr;
#endif
SQLITE_DO(sqlite3_open_v2(FileSystem::longWinPath(filename).toUtf8().constData(), &_db, sqliteFlags, vfs));

if (_errId != SQLITE_OK) {
qCWarning(lcSql) << "Error:" << _error << "for" << filename;
Expand Down