From 7551006102ff8ca0b45d66d3f9ac980cb9032e01 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Thu, 2 Nov 2017 16:35:46 +0100 Subject: [PATCH] Another fix or Unices of the previous commit. --- xs/src/slic3r/GUI/GUI.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/xs/src/slic3r/GUI/GUI.cpp b/xs/src/slic3r/GUI/GUI.cpp index 91de87423..90cb0a93c 100644 --- a/xs/src/slic3r/GUI/GUI.cpp +++ b/xs/src/slic3r/GUI/GUI.cpp @@ -97,15 +97,16 @@ std::vector scan_serial_ports() } #else // UNIX and OS X - boost::filesystem::directory_iterator end; std::initializer_list prefixes { "ttyUSB" , "ttyACM", "tty.", "cu.", "rfcomm" }; - for (boost::filesystem::directory_iterator it_path(boost::filesystem::path("/dev")); - it_path != end; ++ it_path) - for (const char *prefix : prefixes) - if (boost::starts_with(it_path->string(), std::string("/dev/") + prefix)) { - out.emplace_back(path); + for (auto &file : boost::filesystem::directory_iterator(boost::filesystem::path("/dev"))) { + std::string name = it->path().filename().string(); + for (const char *prefix : prefixes) { + if (boost::starts_with(name, prefix)) { + out.emplace_back(it->path().string()); break; } + } + } #endif out.erase(std::remove_if(out.begin(), out.end(),