This commit is contained in:
Branimir Karadžić
2017-11-13 09:23:48 -08:00
parent d5c091eb92
commit 03a6f9d6f2
3 changed files with 14 additions and 8 deletions

View File

@@ -70,12 +70,11 @@ const char* Settings::get(const StringView& _name) const
FilePath uri(_name);
const StringView path = strTrim(uri.getPath(), "/");
const StringView& fileName = uri.getFileName();
int32_t section = INI_GLOBAL_SECTION;
if (!path.isEmpty() )
{
section = ini_find_section(ini, path.getPtr(), path.getLength()-1);
section = ini_find_section(ini, path.getPtr(), path.getLength() );
if (INI_NOT_FOUND == section)
{
section = INI_GLOBAL_SECTION;
@@ -103,10 +102,10 @@ void Settings::set(const StringView& _name, const StringView& _value)
if (!path.isEmpty() )
{
section = ini_find_section(ini, path.getPtr(), path.getLength()-1);
section = ini_find_section(ini, path.getPtr(), path.getLength() );
if (INI_NOT_FOUND == section)
{
section = ini_section_add(ini, path.getPtr(), path.getLength()-1);
section = ini_section_add(ini, path.getPtr(), path.getLength() );
}
}
@@ -146,7 +145,7 @@ void Settings::remove(const StringView& _name) const
if (!path.isEmpty() )
{
section = ini_find_section(ini, path.getPtr(), path.getLength()-1);
section = ini_find_section(ini, path.getPtr(), path.getLength() );
if (INI_NOT_FOUND == section)
{
section = INI_GLOBAL_SECTION;