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