From 027b9f508285b3ab7e9783f4c165aa99bee4f886 Mon Sep 17 00:00:00 2001 From: David Kocik Date: Tue, 10 Dec 2019 14:41:49 +0100 Subject: [PATCH] fix --- src/slic3r/GUI/RemovableDriveManager.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/RemovableDriveManager.cpp b/src/slic3r/GUI/RemovableDriveManager.cpp index 763113ea2..c5dca1bd5 100644 --- a/src/slic3r/GUI/RemovableDriveManager.cpp +++ b/src/slic3r/GUI/RemovableDriveManager.cpp @@ -231,9 +231,10 @@ void RemovableDriveManager::search_for_drives() //search /media/* folder search_path("/media/*", "/media"); +/* //search /Volumes/* folder (OSX) search_path("/Volumes/*", "/Volumes"); - +*/ std::string path(std::getenv("USER")); std::string pp(path); //std::cout << "user: "<< path << "\n"; @@ -286,7 +287,7 @@ void RemovableDriveManager::search_path(const std::string &path,const std::strin { for(size_t i = 0; i < globbuf.gl_pathc; i++) { - + inspect_file(globbuf.gl_pathv[i], parent_path); } }else { @@ -299,11 +300,11 @@ void RemovableDriveManager::search_path(const std::string &path,const std::strin void RemovableDriveManager::inspect_file(const std::string &path, const std::string &parent_path) { //if not same file system - could be removable drive - if(!compare_filesystem_id(globbuf.gl_pathv[i], parent_path)) + if(!compare_filesystem_id(path, parent_path)) { //user id struct stat buf; - stat(globbuf.gl_pathv[i],&buf); + stat(path.c_str(), &buf); uid_t uid = buf.st_uid; std::string username(std::getenv("USER")); struct passwd *pw = getpwuid(uid); @@ -311,8 +312,8 @@ void RemovableDriveManager::inspect_file(const std::string &path, const std::str { if(pw->pw_name == username) { - std::string name = basename(globbuf.gl_pathv[i]); - m_current_drives.push_back(DriveData(name,globbuf.gl_pathv[i])); + std::string name = basename(const_cast(path.c_str())); + m_current_drives.push_back(DriveData(name,path)); } } }