refactor
This commit is contained in:
@ -102,7 +102,9 @@ auto winfsp_drive::winfsp_service::OnStart(ULONG /*Argc*/, PWSTR * /*Argv*/)
|
|||||||
((mount_location.size() == 3U) && (mount_location[2U] == '\\'))) &&
|
((mount_location.size() == 3U) && (mount_location[2U] == '\\'))) &&
|
||||||
(mount_location[1U] == ':');
|
(mount_location[1U] == ':');
|
||||||
|
|
||||||
auto ret = drive_letter ? STATUS_DEVICE_BUSY : STATUS_NOT_SUPPORTED;
|
auto ret{
|
||||||
|
drive_letter ? STATUS_DEVICE_BUSY : STATUS_NOT_SUPPORTED,
|
||||||
|
};
|
||||||
if ((drive_letter && not utils::file::directory(mount_location).exists())) {
|
if ((drive_letter && not utils::file::directory(mount_location).exists())) {
|
||||||
auto unicode_mount_location = utils::string::from_utf8(mount_location);
|
auto unicode_mount_location = utils::string::from_utf8(mount_location);
|
||||||
host_.SetFileSystemName(unicode_mount_location.data());
|
host_.SetFileSystemName(unicode_mount_location.data());
|
||||||
@ -118,15 +120,16 @@ auto winfsp_drive::winfsp_service::OnStart(ULONG /*Argc*/, PWSTR * /*Argv*/)
|
|||||||
<< mount_location << std::endl;
|
<< mount_location << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret != STATUS_SUCCESS) {
|
if (ret == STATUS_SUCCESS) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
if (not lock_.set_mount_state(false, "", -1)) {
|
if (not lock_.set_mount_state(false, "", -1)) {
|
||||||
utils::error::raise_error(function_name, ret,
|
utils::error::raise_error(function_name, ret, "failed to set mount state");
|
||||||
"failed to set mount state");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system::instance().raise<drive_mount_failed>(mount_location,
|
event_system::instance().raise<drive_mount_failed>(mount_location,
|
||||||
std::to_string(ret));
|
std::to_string(ret));
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user