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-16 19:15:27 +0300
committerDavid Kocik <kocikdav@gmail.com>2019-12-16 19:15:27 +0300
commita029e689d81fd099d0a129bf0cdacda2b4b67762 (patch)
treeecca20b4b427f9c4a7a7faeb738d522bf3fda50b /src/slic3r/GUI/RemovableDriveManager.cpp
parentbfc9dda1f6bc9efa9e2616c98ba38c3b52f2ad3f (diff)
verification of save path
Diffstat (limited to 'src/slic3r/GUI/RemovableDriveManager.cpp')
-rw-r--r--src/slic3r/GUI/RemovableDriveManager.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/slic3r/GUI/RemovableDriveManager.cpp b/src/slic3r/GUI/RemovableDriveManager.cpp
index f8d7883f5..52a8c2b77 100644
--- a/src/slic3r/GUI/RemovableDriveManager.cpp
+++ b/src/slic3r/GUI/RemovableDriveManager.cpp
@@ -402,6 +402,7 @@ RemovableDriveManager::RemovableDriveManager():
m_last_update(0),
m_last_save_path(""),
m_last_save_name(""),
+ m_last_save_path_verified(false),
m_is_writing(false),
m_did_eject(false)
#if __APPLE__
@@ -442,7 +443,6 @@ bool RemovableDriveManager::update(const long time,const bool check)
return !m_current_drives.empty();
}
-
bool RemovableDriveManager::is_drive_mounted(const std::string &path)
{
for (auto it = m_current_drives.begin(); it != m_current_drives.end(); ++it)
@@ -461,12 +461,14 @@ std::string RemovableDriveManager::get_drive_path()
reset_last_save_path();
return "";
}
- if (m_last_save_path != "")
+ if (m_last_save_path_verified)
return m_last_save_path;
return m_current_drives.back().path;
}
std::string RemovableDriveManager::get_last_save_path()
{
+ if (!m_last_save_path_verified)
+ return "";
return m_last_save_path;
}
std::string RemovableDriveManager::get_last_save_name()
@@ -481,7 +483,7 @@ void RemovableDriveManager::check_and_notify()
{
if(m_drives_count != m_current_drives.size())
{
- if(m_callbacks.size() != 0 && m_drives_count > m_current_drives.size() && m_last_save_path != "" && !is_drive_mounted(m_last_save_path))
+ if(m_callbacks.size() != 0 && m_drives_count > m_current_drives.size() && m_last_save_path_verified && !is_drive_mounted(m_last_save_path))
{
for (auto it = m_callbacks.begin(); it != m_callbacks.end(); ++it)
{
@@ -501,9 +503,14 @@ void RemovableDriveManager::erase_callbacks()
}
void RemovableDriveManager::set_last_save_path(const std::string& path)
{
- std::string last_drive = get_drive_from_path(path);
- if(last_drive != "")
+ m_last_save_path = path;
+}
+void RemovableDriveManager::verify_last_save_path()
+{
+ std::string last_drive = get_drive_from_path(m_last_save_path);
+ if (last_drive != "")
{
+ m_last_save_path_verified = true;
m_last_save_path = last_drive;
m_last_save_name = get_drive_name(last_drive);
}
@@ -525,7 +532,7 @@ bool RemovableDriveManager::is_last_drive_removed()
{
//std::cout<<"is last: "<<m_last_save_path;
//m_drives_count = m_current_drives.size();
- if(m_last_save_path == "")
+ if(!m_last_save_path_verified)
{
//std::cout<<"\n";
return true;
@@ -542,6 +549,7 @@ bool RemovableDriveManager::is_last_drive_removed_with_update(const long time)
}
void RemovableDriveManager::reset_last_save_path()
{
+ m_last_save_path_verified = false;
m_last_save_path = "";
m_last_save_name = "";
}