Fixing profile loading #1135

This commit is contained in:
jath03 2021-02-24 14:39:08 -08:00 committed by Adam Honse
parent ea6e961a13
commit 84861ef989
5 changed files with 51 additions and 12 deletions

View file

@ -20,7 +20,7 @@ ProfileManager::~ProfileManager()
}
bool ProfileManager::SaveProfile(std::string profile_name)
bool ProfileManager::SaveProfile(std::string profile_name, bool sizes)
{
/*---------------------------------------------------------*\
| Get the list of controllers from the resource manager |
@ -35,7 +35,19 @@ bool ProfileManager::SaveProfile(std::string profile_name)
/*---------------------------------------------------------*\
| Extension .orp - OpenRgb Profile |
\*---------------------------------------------------------*/
std::string filename = profile_name + ".orp";
std::string filename = profile_name;
/*---------------------------------------------------------*\
| Determine file extension |
\*---------------------------------------------------------*/
if(sizes)
{
filename += ".ors";
}
else
{
filename += ".orp";
}
/*---------------------------------------------------------*\
| Open an output file in binary mode |
@ -100,7 +112,8 @@ bool ProfileManager::LoadSizeFromProfile(std::string profile_name)
std::vector<RGBController*> ProfileManager::LoadProfileToList
(
std::string profile_name
std::string profile_name,
bool sizes
)
{
std::vector<RGBController*> temp_controllers;
@ -108,8 +121,21 @@ std::vector<RGBController*> ProfileManager::LoadProfileToList
unsigned int controller_offset = 0;
bool ret_val = false;
std::string filename = configuration_directory + profile_name;
/*---------------------------------------------------------*\
| Determine file extension |
\*---------------------------------------------------------*/
if(sizes)
{
filename += ".ors";
}
else
{
filename += ".orp";
}
/*---------------------------------------------------------*\
| Open input file in binary mode |
\*---------------------------------------------------------*/
@ -292,7 +318,7 @@ bool ProfileManager::LoadProfileWithOptions
std::vector<bool> temp_controller_used;
bool ret_val = false;
std::string filename = configuration_directory + profile_name;
std::string filename = configuration_directory + profile_name + ".orp";
/*---------------------------------------------------------*\
| Get the list of controllers from the resource manager |