Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Matena <lukasmatena@seznam.cz>2021-09-22 12:39:47 +0300
committerLukas Matena <lukasmatena@seznam.cz>2021-09-22 12:58:38 +0300
commitd57d3f99d0874c09700e1a4b780caa14fe788d6e (patch)
tree2a042b462504f069ce1494d57cec86674528fe93 /src/slic3r
parentef800a8547b188e9261defb6a956632c42282574 (diff)
Fix of #3969 (crash if $USER is not set)
Diffstat (limited to 'src/slic3r')
-rw-r--r--src/slic3r/GUI/RemovableDriveManager.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/slic3r/GUI/RemovableDriveManager.cpp b/src/slic3r/GUI/RemovableDriveManager.cpp
index 593d8241d..5fb8b0132 100644
--- a/src/slic3r/GUI/RemovableDriveManager.cpp
+++ b/src/slic3r/GUI/RemovableDriveManager.cpp
@@ -201,9 +201,7 @@ namespace search_for_drives_internal
struct stat buf;
stat(path.c_str(), &buf);
uid_t uid = buf.st_uid;
- std::string username(std::getenv("USER"));
- struct passwd *pw = getpwuid(uid);
- if (pw != 0 && pw->pw_name == username)
+ if (getuid() == uid)
out.emplace_back(DriveData{ boost::filesystem::basename(boost::filesystem::path(path)), path });
}
}
@@ -245,7 +243,7 @@ std::vector<DriveData> RemovableDriveManager::search_for_removable_drives() cons
search_for_drives_internal::search_path("/media/*", "/media", current_drives);
//search_path("/Volumes/*", "/Volumes");
- std::string path(std::getenv("USER"));
+ std::string path = wxGetUserId().ToUTF8().data();
std::string pp(path);
//search /media/USERNAME/* folder