mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-15 19:35:57 +08:00
Prevent SuperSlicer from crashing due to a lack of a $USER env. This was replicated from d57d3f99d0
.
This commit is contained in:
parent
7acc14b06e
commit
8f03c8de4e
@ -201,9 +201,7 @@ namespace search_for_drives_internal
|
|||||||
struct stat buf;
|
struct stat buf;
|
||||||
stat(path.c_str(), &buf);
|
stat(path.c_str(), &buf);
|
||||||
uid_t uid = buf.st_uid;
|
uid_t uid = buf.st_uid;
|
||||||
std::string username(std::getenv("USER"));
|
if (getuid() == uid)
|
||||||
struct passwd *pw = getpwuid(uid);
|
|
||||||
if (pw != 0 && pw->pw_name == username)
|
|
||||||
out.emplace_back(DriveData{ boost::filesystem::basename(boost::filesystem::path(path)), path });
|
out.emplace_back(DriveData{ boost::filesystem::basename(boost::filesystem::path(path)), path });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -243,7 +241,7 @@ std::vector<DriveData> RemovableDriveManager::search_for_removable_drives() cons
|
|||||||
search_for_drives_internal::search_path("/media/*", "/media", current_drives);
|
search_for_drives_internal::search_path("/media/*", "/media", current_drives);
|
||||||
|
|
||||||
//search_path("/Volumes/*", "/Volumes");
|
//search_path("/Volumes/*", "/Volumes");
|
||||||
std::string path(std::getenv("USER"));
|
std::string path = wxGetUserId().ToUTF8().data();
|
||||||
std::string pp(path);
|
std::string pp(path);
|
||||||
|
|
||||||
//search /media/USERNAME/* folder
|
//search /media/USERNAME/* folder
|
||||||
|
Loading…
x
Reference in New Issue
Block a user