mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 09:30:13 +03:00
SqlDatabase: Ask freeSpace for directory, fix for Windows
See owncloud/enterprise#1955
This commit is contained in:
parent
fd40113e48
commit
f8c0e796df
2 changed files with 10 additions and 2 deletions
|
@ -17,6 +17,8 @@
|
|||
#include <QString>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
|
||||
#include "ownsql.h"
|
||||
#include "utility.h"
|
||||
|
@ -101,8 +103,8 @@ bool SqlDatabase::openOrCreateReadWrite( const QString& filename )
|
|||
|
||||
if( !checkDb() ) {
|
||||
// When disk space is low, checking the db may fail even though it's fine.
|
||||
qint64 freeSpace = Utility::freeDiskSpace(filename);
|
||||
if (freeSpace < 1000000) {
|
||||
qint64 freeSpace = Utility::freeDiskSpace(QFileInfo(filename).dir().absolutePath());
|
||||
if (freeSpace != -1 && freeSpace < 1000000) {
|
||||
qDebug() << "Consistency check failed, disk space is low, aborting" << freeSpace;
|
||||
close();
|
||||
return false;
|
||||
|
|
|
@ -43,6 +43,12 @@ namespace Utility
|
|||
OWNCLOUDSYNC_EXPORT QByteArray userAgentString();
|
||||
OWNCLOUDSYNC_EXPORT bool hasLaunchOnStartup(const QString &appName);
|
||||
OWNCLOUDSYNC_EXPORT void setLaunchOnStartup(const QString &appName, const QString& guiName, bool launch);
|
||||
|
||||
/**
|
||||
* Return the amount of free space available.
|
||||
*
|
||||
* \a path must point to a directory
|
||||
*/
|
||||
OWNCLOUDSYNC_EXPORT qint64 freeDiskSpace(const QString &path);
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue