mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 00:14:11 +09:00
[client,SDL] use freerdp_GetConfigFilePath
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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 = "");
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user