mirror of
https://github.com/PixlOne/logiops.git
synced 2025-07-13 21:02:43 +08:00
Call libconfig read/write file with C strings
Older libconfig versions don't support calling these functions with std::string, fixes #364.
This commit is contained in:
parent
c27a6edae8
commit
7147825539
@ -30,7 +30,7 @@ Configuration::Configuration(std::string config_file) :
|
|||||||
_config_file(std::move(config_file)) {
|
_config_file(std::move(config_file)) {
|
||||||
if (std::filesystem::exists(_config_file)) {
|
if (std::filesystem::exists(_config_file)) {
|
||||||
try {
|
try {
|
||||||
_config.readFile(_config_file);
|
_config.readFile(_config_file.c_str());
|
||||||
} catch (const FileIOException& e) {
|
} catch (const FileIOException& e) {
|
||||||
logPrintf(ERROR, "I/O Error while reading %s: %s", _config_file.c_str(),
|
logPrintf(ERROR, "I/O Error while reading %s: %s", _config_file.c_str(),
|
||||||
e.what());
|
e.what());
|
||||||
@ -57,7 +57,7 @@ Configuration::Configuration() {
|
|||||||
void Configuration::save() {
|
void Configuration::save() {
|
||||||
config::set(_config.getRoot(), *this);
|
config::set(_config.getRoot(), *this);
|
||||||
try {
|
try {
|
||||||
_config.writeFile(_config_file);
|
_config.writeFile(_config_file.c_str());
|
||||||
} catch (const FileIOException& e) {
|
} catch (const FileIOException& e) {
|
||||||
logPrintf(ERROR, "I/O Error while writing %s: %s",
|
logPrintf(ERROR, "I/O Error while writing %s: %s",
|
||||||
_config_file.c_str(), e.what());
|
_config_file.c_str(), e.what());
|
||||||
|
Loading…
Reference in New Issue
Block a user