| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 } | 104 } |
| 105 | 105 |
| 106 bool Win32Filesystem::IsFile(const Pathname &path) { | 106 bool Win32Filesystem::IsFile(const Pathname &path) { |
| 107 WIN32_FILE_ATTRIBUTE_DATA data = {0}; | 107 WIN32_FILE_ATTRIBUTE_DATA data = {0}; |
| 108 if (0 == ::GetFileAttributesEx(ToUtf16(path.pathname()).c_str(), | 108 if (0 == ::GetFileAttributesEx(ToUtf16(path.pathname()).c_str(), |
| 109 GetFileExInfoStandard, &data)) | 109 GetFileExInfoStandard, &data)) |
| 110 return false; | 110 return false; |
| 111 return (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0; | 111 return (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0; |
| 112 } | 112 } |
| 113 | 113 |
| 114 bool Win32Filesystem::IsAbsent(const Pathname& path) { | |
| 115 WIN32_FILE_ATTRIBUTE_DATA data = {0}; | |
| 116 if (0 != ::GetFileAttributesEx(ToUtf16(path.pathname()).c_str(), | |
| 117 GetFileExInfoStandard, &data)) | |
| 118 return false; | |
| 119 DWORD err = ::GetLastError(); | |
| 120 return (ERROR_FILE_NOT_FOUND == err || ERROR_PATH_NOT_FOUND == err); | |
| 121 } | |
| 122 | |
| 123 bool Win32Filesystem::GetFileSize(const Pathname &pathname, size_t *size) { | 114 bool Win32Filesystem::GetFileSize(const Pathname &pathname, size_t *size) { |
| 124 WIN32_FILE_ATTRIBUTE_DATA data = {0}; | 115 WIN32_FILE_ATTRIBUTE_DATA data = {0}; |
| 125 if (::GetFileAttributesEx(ToUtf16(pathname.pathname()).c_str(), | 116 if (::GetFileAttributesEx(ToUtf16(pathname.pathname()).c_str(), |
| 126 GetFileExInfoStandard, &data) == 0) | 117 GetFileExInfoStandard, &data) == 0) |
| 127 return false; | 118 return false; |
| 128 *size = data.nFileSizeLow; | 119 *size = data.nFileSizeLow; |
| 129 return true; | 120 return true; |
| 130 } | 121 } |
| 131 | 122 |
| 132 } // namespace rtc | 123 } // namespace rtc |
| OLD | NEW |