Skip to content
Merged
Changes from all commits
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
12 changes: 8 additions & 4 deletions src/emc/usr_intf/emcrsh.cc
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ static std::optional<std::string> getIniVar(const std::string &var, const std::s
{
IniFile inifile(emc_inifile);
if(!inifile)
return nullptr;
return std::nullopt;

return inifile.findString(var, section);
}
Expand Down Expand Up @@ -1269,11 +1269,13 @@ static cmdResponseType setBrake(connectionRecType &ctx)
static std::optional<std::string> findFilename(const std::string &filename)
{
if (filename.size() < 1)
return nullptr;
return std::nullopt;

struct stat sb;
if (filename[0] == '/') { // Absolute path
return !stat(filename.c_str(), &sb) ? filename : nullptr;
if (!stat(filename.c_str(), &sb))
return filename;
return std::nullopt;
}

// Relative name, try the search path
Expand All @@ -1285,7 +1287,9 @@ static std::optional<std::string> findFilename(const std::string &filename)
}

// Last resort, try the filename 'as is'
return !stat(filename.c_str(), &sb) ? filename : nullptr;
if (!stat(filename.c_str(), &sb))
return filename;
return std::nullopt;
}

static cmdResponseType setLoadToolTable(connectionRecType &ctx)
Expand Down
Loading