mirror of
https://github.com/Syping/dtranslatebot.git
synced 2024-11-04 21:16:58 +01:00
remove unnecessary call
This commit is contained in:
parent
cfede2f3e1
commit
5b9c3ce38f
1 changed files with 0 additions and 6 deletions
|
@ -60,17 +60,11 @@ file::file(const std::filesystem::path &storage_path) : m_storagePath(storage_pa
|
|||
}
|
||||
#elif defined(_WIN32)
|
||||
const std::filesystem::path lock_file = storage_path / ".lock";
|
||||
|
||||
fh = CreateFileW(lock_file.c_str(), GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_HIDDEN, NULL);
|
||||
if (fh == INVALID_HANDLE_VALUE) {
|
||||
std::cerr << "[Error] Storage directory " << storage_path << " can not be locked" << std::endl;
|
||||
throw std::system_error(GetLastError(), std::system_category());
|
||||
}
|
||||
if (!LockFile(fh, NULL, NULL, NULL, NULL)) {
|
||||
CloseHandle(fh);
|
||||
std::cerr << "[Error] Storage directory " << storage_path << " can not be locked" << std::endl;
|
||||
throw std::system_error(GetLastError(), std::system_category());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue