mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 09:17:52 -06:00
ommit last filename when checking if path is on drive
This commit is contained in:
parent
3d08e8ae32
commit
7b95ec486f
1 changed files with 9 additions and 3 deletions
|
@ -116,7 +116,9 @@ bool RemovableDriveManager::is_path_on_removable_drive(const std::string &path)
|
||||||
{
|
{
|
||||||
if (m_current_drives.empty())
|
if (m_current_drives.empty())
|
||||||
return false;
|
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)
|
for (auto it = m_current_drives.begin(); it != m_current_drives.end(); ++it)
|
||||||
{
|
{
|
||||||
char drive = (*it).path[0];
|
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)
|
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)
|
for (auto it = m_current_drives.begin(); it != m_current_drives.end(); ++it)
|
||||||
{
|
{
|
||||||
char drive = (*it).path[0];
|
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::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
|
//check if same filesystem
|
||||||
for (auto it = m_current_drives.begin(); it != m_current_drives.end(); ++it)
|
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 (*it).path;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue