Another fix or Unices of the previous commit.
This commit is contained in:
parent
df5628422c
commit
7551006102
@ -97,15 +97,16 @@ std::vector<std::string> scan_serial_ports()
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// UNIX and OS X
|
// UNIX and OS X
|
||||||
boost::filesystem::directory_iterator end;
|
|
||||||
std::initializer_list<const char*> prefixes { "ttyUSB" , "ttyACM", "tty.", "cu.", "rfcomm" };
|
std::initializer_list<const char*> prefixes { "ttyUSB" , "ttyACM", "tty.", "cu.", "rfcomm" };
|
||||||
for (boost::filesystem::directory_iterator it_path(boost::filesystem::path("/dev"));
|
for (auto &file : boost::filesystem::directory_iterator(boost::filesystem::path("/dev"))) {
|
||||||
it_path != end; ++ it_path)
|
std::string name = it->path().filename().string();
|
||||||
for (const char *prefix : prefixes)
|
for (const char *prefix : prefixes) {
|
||||||
if (boost::starts_with(it_path->string(), std::string("/dev/") + prefix)) {
|
if (boost::starts_with(name, prefix)) {
|
||||||
out.emplace_back(path);
|
out.emplace_back(it->path().string());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
out.erase(std::remove_if(out.begin(), out.end(),
|
out.erase(std::remove_if(out.begin(), out.end(),
|
||||||
|
Loading…
Reference in New Issue
Block a user