summaryrefslogtreecommitdiffstats
path: root/qthelper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qthelper.cpp')
-rw-r--r--qthelper.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/qthelper.cpp b/qthelper.cpp
index a4b644304..c591f90dd 100644
--- a/qthelper.cpp
+++ b/qthelper.cpp
@@ -12,6 +12,7 @@
#include <QDir>
#include <QDebug>
#include <QSettings>
+#include <QStandardPaths>
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonObject>
@@ -298,6 +299,20 @@ picture_load_exit:
return;
}
+extern "C" const char *system_default_directory(void)
+{
+ static char filename[PATH_MAX];
+
+ if (!*filename) {
+ QString name = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation).first();
+ QDir dir(name);
+ dir.mkpath(name);
+ // Why no "dir.encodeName()"? Crazy Qt
+ strncpy(filename, QFile::encodeName(name), PATH_MAX-1);
+ }
+ return filename;
+}
+
extern "C" char *get_file_name(const char *fileName)
{
QFileInfo fileInfo(fileName);