From 629b459b35268b0bba31bc824eb7078305d3c210 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 2 Feb 2019 00:50:18 +0100 Subject: options/globals: always return same document directory --- options/globals.cpp | 10 ++++++++-- options/globals.hpp | 1 - 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'options') diff --git a/options/globals.cpp b/options/globals.cpp index 3bd185af..dbc6df90 100644 --- a/options/globals.cpp +++ b/options/globals.cpp @@ -11,7 +11,7 @@ namespace options::globals::detail { ini_ctx::ini_ctx() = default; -bool is_portable_installation() +static bool is_portable_installation() { #if defined _WIN32 // must keep consistent between invocations @@ -143,7 +143,7 @@ void mark_ini_modified(bool value) ini.mtx.unlock(); } -QString ini_directory() +static QString ini_directory_() { QString dir; @@ -173,4 +173,10 @@ QString ini_directory() return dir; } +QString ini_directory() +{ + static const QString dir = ini_directory_(); + return dir; +} + } // ns options::globals diff --git a/options/globals.hpp b/options/globals.hpp index 8032e5d8..5b392055 100644 --- a/options/globals.hpp +++ b/options/globals.hpp @@ -44,7 +44,6 @@ auto with_settings_object_(ini_ctx& ini, F&& fun) OTR_OPTIONS_EXPORT ini_ctx& cur_settings(); OTR_OPTIONS_EXPORT ini_ctx& global_settings(); -OTR_OPTIONS_EXPORT bool is_portable_installation(); } // ns options::globals::detail -- cgit v1.2.3