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 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 bool Win32Filesystem::IsAbsent(const Pathname& path) { | 154 bool Win32Filesystem::IsAbsent(const Pathname& path) { |
155 WIN32_FILE_ATTRIBUTE_DATA data = {0}; | 155 WIN32_FILE_ATTRIBUTE_DATA data = {0}; |
156 if (0 != ::GetFileAttributesEx(ToUtf16(path.pathname()).c_str(), | 156 if (0 != ::GetFileAttributesEx(ToUtf16(path.pathname()).c_str(), |
157 GetFileExInfoStandard, &data)) | 157 GetFileExInfoStandard, &data)) |
158 return false; | 158 return false; |
159 DWORD err = ::GetLastError(); | 159 DWORD err = ::GetLastError(); |
160 return (ERROR_FILE_NOT_FOUND == err || ERROR_PATH_NOT_FOUND == err); | 160 return (ERROR_FILE_NOT_FOUND == err || ERROR_PATH_NOT_FOUND == err); |
161 } | 161 } |
162 | 162 |
163 bool Win32Filesystem::CopyFile(const Pathname &old_path, | |
164 const Pathname &new_path) { | |
165 return ::CopyFile(ToUtf16(old_path.pathname()).c_str(), | |
166 ToUtf16(new_path.pathname()).c_str(), TRUE) != 0; | |
167 } | |
168 | |
169 bool Win32Filesystem::IsTemporaryPath(const Pathname& pathname) { | 163 bool Win32Filesystem::IsTemporaryPath(const Pathname& pathname) { |
170 TCHAR buffer[MAX_PATH + 1]; | 164 TCHAR buffer[MAX_PATH + 1]; |
171 if (!::GetTempPath(arraysize(buffer), buffer)) | 165 if (!::GetTempPath(arraysize(buffer), buffer)) |
172 return false; | 166 return false; |
173 if (!IsCurrentProcessLowIntegrity() && | 167 if (!IsCurrentProcessLowIntegrity() && |
174 !::GetLongPathName(buffer, buffer, arraysize(buffer))) | 168 !::GetLongPathName(buffer, buffer, arraysize(buffer))) |
175 return false; | 169 return false; |
176 return (::strnicmp(ToUtf16(pathname.pathname()).c_str(), | 170 return (::strnicmp(ToUtf16(pathname.pathname()).c_str(), |
177 buffer, strlen(buffer)) == 0); | 171 buffer, strlen(buffer)) == 0); |
178 } | 172 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 } | 211 } |
218 | 212 |
219 bool Win32Filesystem::GetAppTempFolder(Pathname* path) { | 213 bool Win32Filesystem::GetAppTempFolder(Pathname* path) { |
220 if (!GetAppPathname(path)) | 214 if (!GetAppPathname(path)) |
221 return false; | 215 return false; |
222 std::string filename(path->filename()); | 216 std::string filename(path->filename()); |
223 return GetTemporaryFolder(*path, true, &filename); | 217 return GetTemporaryFolder(*path, true, &filename); |
224 } | 218 } |
225 | 219 |
226 } // namespace rtc | 220 } // namespace rtc |
OLD | NEW |