windows paths
This commit is contained in:
parent
0eb8cb3fa1
commit
55409b0e96
1 changed files with 7 additions and 4 deletions
|
@ -62,6 +62,7 @@ void RemovableDriveManager::search_for_drives()
|
||||||
//std::cout << std::string(volumeName.begin(), volumeName.end()) << " " << std::string(fileSystemName.begin(), fileSystemName.end()) << " " << freeSpace.QuadPart << "\n";
|
//std::cout << std::string(volumeName.begin(), volumeName.end()) << " " << std::string(fileSystemName.begin(), fileSystemName.end()) << " " << freeSpace.QuadPart << "\n";
|
||||||
if (free_space.QuadPart > 0)
|
if (free_space.QuadPart > 0)
|
||||||
{
|
{
|
||||||
|
path += "\\";
|
||||||
m_current_drives.push_back(DriveData(boost::nowide::narrow(volume_name), path));
|
m_current_drives.push_back(DriveData(boost::nowide::narrow(volume_name), path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,6 +83,8 @@ void RemovableDriveManager::eject_drive(const std::string &path)
|
||||||
if ((*it).path == path)
|
if ((*it).path == path)
|
||||||
{
|
{
|
||||||
std::string mpath = "\\\\.\\" + path;
|
std::string mpath = "\\\\.\\" + path;
|
||||||
|
mpath = mpath.substr(0, mpath.size() - 1);
|
||||||
|
std::cout << "Ejecting " << mpath << "\n";
|
||||||
HANDLE handle = CreateFileA(mpath.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr);
|
HANDLE handle = CreateFileA(mpath.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr);
|
||||||
if (handle == INVALID_HANDLE_VALUE)
|
if (handle == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
|
@ -299,11 +302,11 @@ std::string RemovableDriveManager::get_last_drive_path()
|
||||||
{
|
{
|
||||||
if (!m_current_drives.empty())
|
if (!m_current_drives.empty())
|
||||||
{
|
{
|
||||||
#if _WIN32
|
//#if _WIN32
|
||||||
return m_current_drives.back().path + "\\";
|
// return m_current_drives.back().path + "\\";
|
||||||
#else
|
//#else
|
||||||
return m_current_drives.back().path;
|
return m_current_drives.back().path;
|
||||||
#endif
|
//#endif
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue