[client,SDL] use freerdp_GetConfigFilePath

This commit is contained in:
Armin Novak
2025-12-03 14:21:10 +01:00
parent f533089b98
commit 81bdebdd09
2 changed files with 3 additions and 14 deletions

View File

@@ -31,6 +31,7 @@ namespace fs = std::experimental::filesystem;
#endif
#include "sdl_prefs.hpp"
#include "sdl_common_utils.hpp"
#include <winpr/path.h>
#include <winpr/config.h>
@@ -218,21 +219,10 @@ SdlPref::SdlPref(std::string file)
{
}
std::string SdlPref::get_pref_dir(bool systemConfigOnly)
{
using CStringPtr = std::unique_ptr<char, decltype(&free)>;
CStringPtr path(freerdp_GetConfigFilePath(systemConfigOnly, ""), free);
if (!path)
return {};
fs::path config{ path.get() };
return config.string();
}
std::string SdlPref::get_default_file(bool systemConfigOnly)
{
fs::path config{ SdlPref::get_pref_dir(systemConfigOnly) };
config /= "sdl-freerdp.json";
CStringPtr name(freerdp_GetConfigFilePath(systemConfigOnly, "sdl-freerdp.json"), free);
fs::path config{ name.get() };
return config.string();
}

View File

@@ -63,7 +63,6 @@ class SdlPref
[[nodiscard]] bool is_user_config_enabled() const;
static std::string get_pref_dir(bool systemConfigOnly);
static std::string get_default_file(bool systemConfigOnly);
static std::string item_to_str(WINPR_JSON* item, const std::string& fallback = "");
};