* gui: fix media eject on linux (#4700) Removable media is not ejected on linux platform Make get_removable_drive_from_path() check if path is a dir or not. Trim last component in latter case only. * Revert unnecessary style changes
This commit is contained in:
parent
a980bb6a6a
commit
45ef4ae790
1 changed files with 7 additions and 6 deletions
|
@ -370,11 +370,12 @@ std::string RemovableDriveManager::get_removable_drive_path(const std::string &p
|
||||||
|
|
||||||
std::string RemovableDriveManager::get_removable_drive_from_path(const std::string& path)
|
std::string RemovableDriveManager::get_removable_drive_from_path(const std::string& path)
|
||||||
{
|
{
|
||||||
|
std::string new_path(path);
|
||||||
|
if (!boost::filesystem::is_directory(path)) {
|
||||||
std::size_t found = path.find_last_of("/");
|
std::size_t found = path.find_last_of("/");
|
||||||
std::string new_path = found == path.size() - 1 ? path.substr(0, found) : path;
|
if (found != std::string::npos)
|
||||||
// trim the filename
|
new_path.erase(found);
|
||||||
found = new_path.find_last_of("/");
|
}
|
||||||
new_path = new_path.substr(0, found);
|
|
||||||
|
|
||||||
// check if same filesystem
|
// check if same filesystem
|
||||||
std::scoped_lock<std::mutex> lock(m_drives_mutex);
|
std::scoped_lock<std::mutex> lock(m_drives_mutex);
|
||||||
|
|
Loading…
Reference in a new issue