cache_util_win.cc 819 B

1234567891011121314151617181920212223242526
  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "net/disk_cache/cache_util.h"
  5. #include <windows.h>
  6. #include "base/files/file_path.h"
  7. #include "base/logging.h"
  8. #include "base/strings/string_util.h"
  9. #include "base/win/scoped_handle.h"
  10. namespace disk_cache {
  11. bool MoveCache(const base::FilePath& from_path, const base::FilePath& to_path) {
  12. // I don't want to use the shell version of move because if something goes
  13. // wrong, that version will attempt to move file by file and fail at the end.
  14. if (!MoveFileEx(from_path.value().c_str(), to_path.value().c_str(), 0)) {
  15. PLOG(ERROR) << "Unable to move the cache";
  16. return false;
  17. }
  18. return true;
  19. }
  20. } // namespace disk_cache