Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: std filesystem path compatibiltiy
  • Loading branch information
PawelKorsak committed Mar 24, 2026
commit f79348ff50f81b5687dc6081a1afe0cfab0c595a
22 changes: 12 additions & 10 deletions candletool/src/md_cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,18 +484,19 @@ namespace mab
return;
}

std::string configFilePath = *downloadConfigOptions.configFile;
std::filesystem::path configFilePath = *downloadConfigOptions.configFile;
if (configFilePath.empty())
{
m_logger.error("Configuration file path is empty!");
return;
}
// If the path is not specified, prepend the standard path
if (std::find(configFilePath.begin(), configFilePath.end(), '/') ==
configFilePath.end() || std::find(configFilePath.begin(), configFilePath.end(), '\\') ==
configFilePath.end())
std::string matchString = configFilePath.string();
if (std::find(matchString.begin(), matchString.end(), '/') ==
matchString.end() || std::find(matchString.begin(), matchString.end(), '\\') ==
matchString.end())
{
configFilePath = std::string(DEFAULT_CANDLETOOL_CONFIG_DIR) + "/config/motors/" + configFilePath;
configFilePath = std::filesystem::path(DEFAULT_CANDLETOOL_CONFIG_DIR) / std::filesystem::path("/config/motors/") / configFilePath;
}

MDConfigMap cfgMap;
Expand Down Expand Up @@ -537,18 +538,19 @@ namespace mab
return;
}

std::string configFilePath = *uploadConfigOptions.configFile;
std::filesystem::path configFilePath = *uploadConfigOptions.configFile;
if (configFilePath.empty())
{
m_logger.error("Configuration file path is empty!");
return;
}
// If the path is not specified, prepend the standard path
if (std::find(configFilePath.begin(), configFilePath.end(), '/') ==
configFilePath.end() || std::find(configFilePath.begin(), configFilePath.end(), '\\') ==
configFilePath.end())
std::string matchString = configFilePath.string();
if (std::find(matchString.begin(), matchString.end(), '/') ==
matchString.end() || std::find(matchString.begin(), matchString.end(), '\\') ==
matchString.end())
{
configFilePath = std::string(DEFAULT_CANDLETOOL_CONFIG_DIR) + "/config/motors/" + configFilePath;
configFilePath = DEFAULT_CANDLETOOL_CONFIG_DIR / "/config/motors/" / configFilePath;
}

mINI::INIFile configFile(configFilePath);
Expand Down