Normalising config directory to ensure it has trailing path separator resolving #2552
* Moved Setter next to Getter * Set `config_dir` to ensure consistent directory for all files resolving #2551 * Changed PluginManager loading log message to include directory
This commit is contained in:
parent
663b28508c
commit
2770206a8d
3 changed files with 32 additions and 19 deletions
|
|
@ -481,13 +481,6 @@ void ResourceManager::SetupConfigurationDirectory()
|
|||
| Create OpenRGB configuration directory if it doesn't exist |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
filesystem::create_directories(config_dir);
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| Create OpenRGB plugins directory |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
std::string plugins_dir = config_dir + "plugins";
|
||||
|
||||
filesystem::create_directories(plugins_dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -500,6 +493,26 @@ std::string ResourceManager::GetConfigurationDirectory()
|
|||
return(config_dir);
|
||||
}
|
||||
|
||||
void ResourceManager::SetConfigurationDirectory(std::string directory)
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Ensure the directory string has a trailing slash |
|
||||
\*-----------------------------------------------------*/
|
||||
const char separator = filesystem::path::preferred_separator;
|
||||
|
||||
if(directory[directory.size() - 1] != separator)
|
||||
{
|
||||
directory += separator;
|
||||
}
|
||||
|
||||
config_dir = directory;
|
||||
settings_manager->LoadSettings(directory + "OpenRGB.json");
|
||||
profile_manager->SetConfigurationDirectory(directory);
|
||||
|
||||
rgb_controllers_sizes.clear();
|
||||
rgb_controllers_sizes = profile_manager->LoadProfileToList("sizes", true);
|
||||
}
|
||||
|
||||
NetworkServer* ResourceManager::GetServer()
|
||||
{
|
||||
return(server);
|
||||
|
|
@ -579,15 +592,6 @@ const char *ResourceManager::GetDetectionString()
|
|||
return (detection_string);
|
||||
}
|
||||
|
||||
void ResourceManager::SetConfigurationDirectory(std::string directory)
|
||||
{
|
||||
settings_manager->LoadSettings(directory + "OpenRGB.json");
|
||||
profile_manager->SetConfigurationDirectory(directory);
|
||||
|
||||
rgb_controllers_sizes.clear();
|
||||
rgb_controllers_sizes = profile_manager->LoadProfileToList("sizes", true);
|
||||
}
|
||||
|
||||
void ResourceManager::Cleanup()
|
||||
{
|
||||
ResourceManager::get()->WaitForDeviceDetection();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue