diff --git a/src/database_file.cpp b/src/database_file.cpp index 5f042fd..19ec400 100644 --- a/src/database_file.cpp +++ b/src/database_file.cpp @@ -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 }