OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/base/win32filesystem.h" | 11 #include "webrtc/base/win32filesystem.h" |
12 | 12 |
13 #include "webrtc/base/win32.h" | 13 #include "webrtc/base/win32.h" |
14 #include <shellapi.h> | 14 #include <shellapi.h> |
15 #include <shlobj.h> | 15 #include <shlobj.h> |
16 #include <tchar.h> | 16 #include <tchar.h> |
17 | 17 |
18 #include <memory> | 18 #include <memory> |
19 | 19 |
20 #include "webrtc/base/arraysize.h" | 20 #include "webrtc/base/arraysize.h" |
| 21 #include "webrtc/base/checks.h" |
21 #include "webrtc/base/fileutils.h" | 22 #include "webrtc/base/fileutils.h" |
22 #include "webrtc/base/pathutils.h" | 23 #include "webrtc/base/pathutils.h" |
23 #include "webrtc/base/stream.h" | 24 #include "webrtc/base/stream.h" |
24 #include "webrtc/base/stringutils.h" | 25 #include "webrtc/base/stringutils.h" |
25 | 26 |
26 // In several places in this file, we test the integrity level of the process | 27 // In several places in this file, we test the integrity level of the process |
27 // before calling GetLongPathName. We do this because calling GetLongPathName | 28 // before calling GetLongPathName. We do this because calling GetLongPathName |
28 // when running under protected mode IE (a low integrity process) can result in | 29 // when running under protected mode IE (a low integrity process) can result in |
29 // a virtualized path being returned, which is wrong if you only plan to read. | 30 // a virtualized path being returned, which is wrong if you only plan to read. |
30 // TODO: Waiting to hear back from IE team on whether this is the | 31 // TODO: Waiting to hear back from IE team on whether this is the |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 } | 111 } |
111 return !create || CreateFolder(pathname); | 112 return !create || CreateFolder(pathname); |
112 } | 113 } |
113 | 114 |
114 std::string Win32Filesystem::TempFilename(const Pathname &dir, | 115 std::string Win32Filesystem::TempFilename(const Pathname &dir, |
115 const std::string &prefix) { | 116 const std::string &prefix) { |
116 wchar_t filename[MAX_PATH]; | 117 wchar_t filename[MAX_PATH]; |
117 if (::GetTempFileName(ToUtf16(dir.pathname()).c_str(), | 118 if (::GetTempFileName(ToUtf16(dir.pathname()).c_str(), |
118 ToUtf16(prefix).c_str(), 0, filename) != 0) | 119 ToUtf16(prefix).c_str(), 0, filename) != 0) |
119 return ToUtf8(filename); | 120 return ToUtf8(filename); |
120 ASSERT(false); | 121 RTC_NOTREACHED(); |
121 return ""; | 122 return ""; |
122 } | 123 } |
123 | 124 |
124 bool Win32Filesystem::MoveFile(const Pathname &old_path, | 125 bool Win32Filesystem::MoveFile(const Pathname &old_path, |
125 const Pathname &new_path) { | 126 const Pathname &new_path) { |
126 if (!IsFile(old_path)) { | 127 if (!IsFile(old_path)) { |
127 ASSERT(IsFile(old_path)); | 128 ASSERT(IsFile(old_path)); |
128 return false; | 129 return false; |
129 } | 130 } |
130 LOG(LS_INFO) << "Moving " << old_path.pathname() | 131 LOG(LS_INFO) << "Moving " << old_path.pathname() |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 (PULARGE_INTEGER)&total_number_of_bytes, | 288 (PULARGE_INTEGER)&total_number_of_bytes, |
288 (PULARGE_INTEGER)&total_number_of_free_bytes)) { | 289 (PULARGE_INTEGER)&total_number_of_free_bytes)) { |
289 return true; | 290 return true; |
290 } else { | 291 } else { |
291 LOG(LS_VERBOSE) << "GetDiskFreeSpaceEx returns error."; | 292 LOG(LS_VERBOSE) << "GetDiskFreeSpaceEx returns error."; |
292 return false; | 293 return false; |
293 } | 294 } |
294 } | 295 } |
295 | 296 |
296 } // namespace rtc | 297 } // namespace rtc |
OLD | NEW |