From f6981f021022a76498b417f1a34b4a21535c1a26 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 13 Jun 2015 18:25:36 -0700 Subject: Add helper function to create a directory Yes, this could easily done from the C code. But this seems just so much easier and I don't have to worry about the oddities of Windows and all that. I'm lazy. So sue me. Signed-off-by: Dirk Hohndel --- qthelper.cpp | 7 +++++++ qthelperfromc.h | 1 + 2 files changed, 8 insertions(+) diff --git a/qthelper.cpp b/qthelper.cpp index 12ce2cb3c..e25be9c26 100644 --- a/qthelper.cpp +++ b/qthelper.cpp @@ -1073,3 +1073,10 @@ extern "C" void updateWindowTitle() { MainWindow::instance()->setTitle(); } + +extern "C" void subsurface_mkdir(const char *dir) +{ + QDir directory; + if (!directory.mkpath(QString(dir))) + qDebug() << "failed to create path" << dir; +} diff --git a/qthelperfromc.h b/qthelperfromc.h index 900085fa4..c9e400ff8 100644 --- a/qthelperfromc.h +++ b/qthelperfromc.h @@ -5,5 +5,6 @@ bool getProxyString(char **buffer); bool canReachCloudServer(); void updateWindowTitle(); bool isCloudUrl(const char *filename); +void subsurface_mkdir(const char *dir); #endif // QTHELPERFROMC_H -- cgit v1.2.3-70-g09d2