示例#1
0
文件: main.cpp 项目: keitee/kb
void decrypt_file(
   fs::path const & filepath,
   std::string_view password)
{
   auto temppath = fs::temp_directory_path() / filepath.filename();

   decrypt_file(filepath, temppath, password);

   fs::remove(filepath);
   fs::rename(temppath, filepath);
}
示例#2
0
FileWatchWin::FileWatchWin(const std::filesystem::path& path, const FileMonitor::t_callbackFunc& callback, DWORD dwNotifyFilter, HANDLE hDirectory) :
  FileWatch(path),
  m_callback(callback),
  m_dwNotifyFilter(dwNotifyFilter),
  m_hDirectory(hDirectory)
{
  std::string filename = path.filename().string();
  m_filename.assign(filename.begin(), filename.end());

  memset(m_pOverlapped.get(), 0, sizeof(*m_pOverlapped));
  m_pOverlapped->hEvent = CreateEvent(nullptr, true, false, nullptr);
}