Fixed parsing of older PrusaSlicer.ini files.
This commit is contained in:
parent
c6940970f2
commit
0548df9a76
@ -812,13 +812,11 @@ static boost::optional<Semver> parse_semver_from_ini(std::string path)
|
|||||||
std::stringstream buffer;
|
std::stringstream buffer;
|
||||||
buffer << stream.rdbuf();
|
buffer << stream.rdbuf();
|
||||||
std::string body = buffer.str();
|
std::string body = buffer.str();
|
||||||
size_t end_line = body.find_first_of("\n\r");
|
|
||||||
body.resize(end_line);
|
|
||||||
size_t start = body.find("PrusaSlicer ");
|
size_t start = body.find("PrusaSlicer ");
|
||||||
if (start == std::string::npos)
|
if (start == std::string::npos)
|
||||||
return boost::none;
|
return boost::none;
|
||||||
body = body.substr(start + 12);
|
body = body.substr(start + 12);
|
||||||
size_t end = body.find_first_of(" \n\r");
|
size_t end = body.find_first_of(" \n");
|
||||||
if (end < body.size())
|
if (end < body.size())
|
||||||
body.resize(end);
|
body.resize(end);
|
||||||
return Semver::parse(body);
|
return Semver::parse(body);
|
||||||
|
Loading…
Reference in New Issue
Block a user