From 272755e1ec4856f3baa32bb6269c73feef6cbbd5 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 13 Jan 2016 10:31:02 +0100 Subject: [PATCH] ConfigFile: Create the directory when using --confdir and it does not exist Previously we would fail to start if the directory was not existing. This was working for relative directory, but it should also work for absolute ones https://github.com/owncloud/enterprise/issues/970 --- src/libsync/configfile.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/libsync/configfile.cpp b/src/libsync/configfile.cpp index 2917be13f..af54772b6 100644 --- a/src/libsync/configfile.cpp +++ b/src/libsync/configfile.cpp @@ -95,11 +95,9 @@ bool ConfigFile::setConfDir(const QString &value) if( dirPath.isEmpty() ) return false; QFileInfo fi(dirPath); - if ( !fi.exists() && !fi.isAbsolute() ) { - QDir::current().mkdir(dirPath); - QDir dir = QDir::current(); - dir.cd(dirPath); - fi.setFile(dir.path()); + if ( !fi.exists() ) { + QDir().mkpath(dirPath); + fi.setFile(dirPath); } if( fi.exists() && fi.isDir() ) { dirPath = fi.absoluteFilePath(); -- 2.30.2