See owncloud/enterprise#1955
#include <QString>
#include <QDebug>
#include <QFile>
+#include <QFileInfo>
+#include <QDir>
#include "ownsql.h"
#include "utility.h"
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;
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);
/**