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

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kocik <kocikdav@gmail.com>2019-12-19 13:47:02 +0300
committerDavid Kocik <kocikdav@gmail.com>2019-12-19 13:47:02 +0300
commit7b95ec486f7ab2c6bff18fada8f8e0f08bfa9d58 (patch)
treeb7c60c64149f231f10904d41c84e853825954c71 /src/slic3r/GUI/RemovableDriveManager.cpp
parent3d08e8ae321a5c75976b336055a9bc0208c47507 (diff)
ommit last filename when checking if path is on drive
Diffstat (limited to 'src/slic3r/GUI/RemovableDriveManager.cpp')
-rw-r--r--src/slic3r/GUI/RemovableDriveManager.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/slic3r/GUI/RemovableDriveManager.cpp b/src/slic3r/GUI/RemovableDriveManager.cpp
index d9cecc3e8..736984755 100644
--- a/src/slic3r/GUI/RemovableDriveManager.cpp
+++ b/src/slic3r/GUI/RemovableDriveManager.cpp
@@ -116,7 +116,9 @@ bool RemovableDriveManager::is_path_on_removable_drive(const std::string &path)
{
if (m_current_drives.empty())
return false;
- int letter = PathGetDriveNumberA(path.c_str());
+ std::size_t found = path.find_last_of("\\");
+ std::string new_path = path.substr(0, found);
+ int letter = PathGetDriveNumberA(new_path.c_str());
for (auto it = m_current_drives.begin(); it != m_current_drives.end(); ++it)
{
char drive = (*it).path[0];
@@ -127,7 +129,9 @@ bool RemovableDriveManager::is_path_on_removable_drive(const std::string &path)
}
std::string RemovableDriveManager::get_drive_from_path(const std::string& path)
{
- int letter = PathGetDriveNumberA(path.c_str());
+ std::size_t found = path.find_last_of("\\");
+ std::string new_path = path.substr(0, found);
+ int letter = PathGetDriveNumberA(new_path.c_str());
for (auto it = m_current_drives.begin(); it != m_current_drives.end(); ++it)
{
char drive = (*it).path[0];
@@ -391,10 +395,12 @@ bool RemovableDriveManager::is_path_on_removable_drive(const std::string &path)
}
std::string RemovableDriveManager::get_drive_from_path(const std::string& path)
{
+ std::size_t found = path.find_last_of("/");
+ std::string new_path = path.substr(0, found);
//check if same filesystem
for (auto it = m_current_drives.begin(); it != m_current_drives.end(); ++it)
{
- if (compare_filesystem_id(path, (*it).path))
+ if (compare_filesystem_id(new_path, (*it).path))
return (*it).path;
}
return "";