23#include <freerdp/utils/helpers.h>
25#include <winpr/path.h>
26#include <freerdp/version.h>
27#include <freerdp/build-config.h>
29#if !defined(WITH_FULL_CONFIG_PATH)
30WINPR_ATTR_MALLOC(free, 1)
31static
char* freerdp_settings_get_legacy_config_path(const
char* filename)
33 char product[
sizeof(FREERDP_PRODUCT_STRING)] = { 0 };
35 for (
size_t i = 0; i <
sizeof(product); i++)
36 product[i] = (
char)tolower(FREERDP_PRODUCT_STRING[i]);
38 char* path = GetKnownSubPath(KNOWN_PATH_XDG_CONFIG_HOME, product);
43 char* filepath = GetCombinedPath(path, filename);
49char* freerdp_GetConfigFilePath(BOOL system,
const char* filename)
51 eKnownPathTypes
id = system ? KNOWN_PATH_SYSTEM_CONFIG_HOME : KNOWN_PATH_XDG_CONFIG_HOME;
53#if defined(FREERDP_USE_VENDOR_PRODUCT_CONFIG_DIR)
54 char* vendor = GetKnownSubPath(
id, FREERDP_VENDOR_STRING);
56#if !defined(WITH_FULL_CONFIG_PATH)
57 if (!system && (_stricmp(FREERDP_VENDOR_STRING, FREERDP_PRODUCT_STRING) == 0))
58 return freerdp_settings_get_legacy_config_path(filename);
61 char* vendor = GetKnownPath(
id);
66#if defined(WITH_RESOURCE_VERSIONING)
67 const char* verstr = FREERDP_PRODUCT_STRING FREERDP_API_VERSION;
69 const char* verstr = FREERDP_PRODUCT_STRING;
72 char* base = GetCombinedPath(vendor, verstr);
81 char* path = GetCombinedPath(base, filename);
86WINPR_JSON* freerdp_GetJSONConfigFile(BOOL system,
const char* filename)
88 char* path = freerdp_GetConfigFilePath(system, filename);
WINPR_API WINPR_JSON * WINPR_JSON_ParseFromFile(const char *filename)
Parse a JSON string read from a file filename.