diff --git a/External/FEXCore/Source/Interface/Config/Config.cpp b/External/FEXCore/Source/Interface/Config/Config.cpp index ad241e09f..af977ab45 100644 --- a/External/FEXCore/Source/Interface/Config/Config.cpp +++ b/External/FEXCore/Source/Interface/Config/Config.cpp @@ -83,7 +83,7 @@ namespace FEXCore::Config { return ConfigFile; } - std::string GetApplicationConfig(std::string &Filename, bool Global) { + std::string GetApplicationConfig(const std::string &Filename, bool Global) { std::string ConfigFile = GetConfigDirectory(Global); if (!Global && !std::filesystem::exists(ConfigFile) && diff --git a/External/FEXCore/include/FEXCore/Config/Config.h b/External/FEXCore/include/FEXCore/Config/Config.h index 5af5c8d94..79549ba2a 100644 --- a/External/FEXCore/include/FEXCore/Config/Config.h +++ b/External/FEXCore/include/FEXCore/Config/Config.h @@ -57,7 +57,7 @@ namespace Type { __attribute__((visibility("default"))) std::string GetDataDirectory(); __attribute__((visibility("default"))) std::string GetConfigDirectory(bool Global); __attribute__((visibility("default"))) std::string GetConfigFileLocation(); - __attribute__((visibility("default"))) std::string GetApplicationConfig(std::string &Filename, bool Global); + __attribute__((visibility("default"))) std::string GetApplicationConfig(const std::string &Filename, bool Global); using LayerValue = std::list; using LayerOptions = std::unordered_map; diff --git a/Source/Common/Config.cpp b/Source/Common/Config.cpp index e147d103d..406c61cc6 100644 --- a/Source/Common/Config.cpp +++ b/Source/Common/Config.cpp @@ -17,7 +17,7 @@ #include namespace FEX::Config { - bool LoadConfigFile(std::vector &Data, std::string Config) { + static bool LoadConfigFile(std::vector &Data, const std::string &Config) { std::fstream ConfigFile; ConfigFile.open(Config, std::ios::in); @@ -72,7 +72,7 @@ namespace FEX::Config { return &*alloc->json_objects->emplace(alloc->json_objects->end()); } - void LoadJSonConfig(std::string &Config, std::function Func) { + static void LoadJSonConfig(const std::string &Config, std::function Func) { std::vector Data; if (!LoadConfigFile(Data, Config)) { return; @@ -132,7 +132,7 @@ namespace FEX::Config { #include }}; - void SaveLayerToJSON(std::string Filename, FEXCore::Config::Layer *const Layer) { + void SaveLayerToJSON(const std::string& Filename, FEXCore::Config::Layer *const Layer) { char Buffer[4096]; char *Dest{}; Dest = json_objOpen(Buffer, nullptr); @@ -181,7 +181,7 @@ namespace FEX::Config { }); } - AppLoader::AppLoader(std::string Filename, bool Global) + AppLoader::AppLoader(const std::string& Filename, bool Global) : FEX::Config::OptionMapper(Global ? FEXCore::Config::LayerType::LAYER_GLOBAL_APP : FEXCore::Config::LayerType::LAYER_LOCAL_APP) { Config = FEXCore::Config::GetApplicationConfig(Filename, Global); diff --git a/Source/Common/Config.h b/Source/Common/Config.h index adde2c15b..f7ec0224d 100644 --- a/Source/Common/Config.h +++ b/Source/Common/Config.h @@ -40,7 +40,7 @@ namespace FEX::Config { class AppLoader final : public FEX::Config::OptionMapper { public: - explicit AppLoader(std::string Filename, bool Global); + explicit AppLoader(const std::string& Filename, bool Global); void Load(); private: @@ -56,5 +56,5 @@ namespace FEX::Config { char *const *envp; }; - void SaveLayerToJSON(std::string Filename, FEXCore::Config::Layer *const Layer); + void SaveLayerToJSON(const std::string& Filename, FEXCore::Config::Layer *const Layer); }