diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-10-08 13:43:42 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-10-08 13:43:42 +0200 |
commit | e2d5245359de0cd419d49b1f3c8e1392c5d9342a (patch) | |
tree | 8bd0a19cdf7e04d4cc344031b231ffbc2437d527 | |
parent | 863b8cad6d95ed2492ac929066f843664a49998d (diff) |
use "static" once, don't propagate from a macro
-rw-r--r-- | cmake/opentrack-boilerplate.cmake | 8 | ||||
-rw-r--r-- | compat/base-path.cpp | 10 | ||||
-rw-r--r-- | compat/base-path.hpp | 9 | ||||
-rw-r--r-- | compat/util.hpp | 1 | ||||
-rw-r--r-- | csv/csv.cpp | 1 | ||||
-rw-r--r-- | tracker-hatire/thread.cpp | 3 |
6 files changed, 24 insertions, 8 deletions
diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake index 1a51413f..36c8d666 100644 --- a/cmake/opentrack-boilerplate.cmake +++ b/cmake/opentrack-boilerplate.cmake @@ -4,14 +4,10 @@ set(opentrack-perms-exec "${opentrack-perms-dir}") set(new-hier-path "#pragma once #ifndef OPENTRACK_NO_QT_PATH - # include <QCoreApplication> # include <QString> - -# define OPENTRACK_BASE_PATH (([]() -> const QString& { \\ - const static QString const__path___ = QCoreApplication::applicationDirPath(); \\ - return const__path___; \\ - })()) +# include \"compat/base-path.hpp\" +# define OPENTRACK_BASE_PATH (application_base_path()) #endif #define OPENTRACK_LIBRARY_PATH \"${opentrack-hier-path}\" #define OPENTRACK_DOC_PATH \"${opentrack-hier-doc}\" diff --git a/compat/base-path.cpp b/compat/base-path.cpp new file mode 100644 index 00000000..3285bac8 --- /dev/null +++ b/compat/base-path.cpp @@ -0,0 +1,10 @@ +#include "base-path.hpp" +#include <QCoreApplication> + +OTR_COMPAT_EXPORT +never_inline +const QString& application_base_path() +{ + static QString const& const_path = QCoreApplication::applicationDirPath(); + return const_path; +} diff --git a/compat/base-path.hpp b/compat/base-path.hpp new file mode 100644 index 00000000..3dbf2a3f --- /dev/null +++ b/compat/base-path.hpp @@ -0,0 +1,9 @@ +#pragma once + +#include "macros.hpp" +#include <QString> +#include "export.hpp" + +OTR_COMPAT_EXPORT +never_inline +const QString& application_base_path(); diff --git a/compat/util.hpp b/compat/util.hpp index 811f2c1d..cd0dbdef 100644 --- a/compat/util.hpp +++ b/compat/util.hpp @@ -1,5 +1,6 @@ #pragma once +#include "opentrack-library-path.h" #include "ndebug-guard.hpp" #include "run-in-thread.hpp" #include "meta.hpp" diff --git a/csv/csv.cpp b/csv/csv.cpp index 31548f78..05df7da0 100644 --- a/csv/csv.cpp +++ b/csv/csv.cpp @@ -13,7 +13,6 @@ #include "opentrack-library-path.h" #include <QTextDecoder> #include <QFile> -#include <QCoreApplication> #include <QString> #include <QDebug> diff --git a/tracker-hatire/thread.cpp b/tracker-hatire/thread.cpp index 506ccfcf..1f976c35 100644 --- a/tracker-hatire/thread.cpp +++ b/tracker-hatire/thread.cpp @@ -1,5 +1,6 @@ #include "thread.hpp" #include "compat/sleep.hpp" +#include "compat/util.hpp" #include <utility> #include <QTextStream> @@ -52,7 +53,7 @@ struct Diag final : public QFile { Diag() { - setFileName(QCoreApplication::applicationDirPath() + "/HATDiagnostics.txt"); + setFileName(OPENTRACK_BASE_PATH + "/HATDiagnostics.txt"); } }; |