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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 bool Win32Filesystem::DeleteFile(const Pathname &filename) { | 66 bool Win32Filesystem::DeleteFile(const Pathname &filename) { |
67 LOG(LS_INFO) << "Deleting file " << filename.pathname(); | 67 LOG(LS_INFO) << "Deleting file " << filename.pathname(); |
68 if (!IsFile(filename)) { | 68 if (!IsFile(filename)) { |
69 RTC_DCHECK(IsFile(filename)); | 69 RTC_DCHECK(IsFile(filename)); |
70 return false; | 70 return false; |
71 } | 71 } |
72 return ::DeleteFile(ToUtf16(filename.pathname()).c_str()) != 0; | 72 return ::DeleteFile(ToUtf16(filename.pathname()).c_str()) != 0; |
73 } | 73 } |
74 | 74 |
75 bool Win32Filesystem::DeleteEmptyFolder(const Pathname &folder) { | |
76 LOG(LS_INFO) << "Deleting folder " << folder.pathname(); | |
77 | |
78 std::string no_slash(folder.pathname(), 0, folder.pathname().length()-1); | |
79 return ::RemoveDirectory(ToUtf16(no_slash).c_str()) != 0; | |
80 } | |
81 | |
82 bool Win32Filesystem::GetTemporaryFolder(Pathname &pathname, bool create, | 75 bool Win32Filesystem::GetTemporaryFolder(Pathname &pathname, bool create, |
83 const std::string *append) { | 76 const std::string *append) { |
84 wchar_t buffer[MAX_PATH + 1]; | 77 wchar_t buffer[MAX_PATH + 1]; |
85 if (!::GetTempPath(arraysize(buffer), buffer)) | 78 if (!::GetTempPath(arraysize(buffer), buffer)) |
86 return false; | 79 return false; |
87 if (!IsCurrentProcessLowIntegrity() && | 80 if (!IsCurrentProcessLowIntegrity() && |
88 !::GetLongPathName(buffer, buffer, arraysize(buffer))) | 81 !::GetLongPathName(buffer, buffer, arraysize(buffer))) |
89 return false; | 82 return false; |
90 size_t len = strlen(buffer); | 83 size_t len = strlen(buffer); |
91 if ((len > 0) && (buffer[len-1] != '\\')) { | 84 if ((len > 0) && (buffer[len-1] != '\\')) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 176 |
184 bool Win32Filesystem::GetAppPathname(Pathname* path) { | 177 bool Win32Filesystem::GetAppPathname(Pathname* path) { |
185 TCHAR buffer[MAX_PATH + 1]; | 178 TCHAR buffer[MAX_PATH + 1]; |
186 if (0 == ::GetModuleFileName(nullptr, buffer, arraysize(buffer))) | 179 if (0 == ::GetModuleFileName(nullptr, buffer, arraysize(buffer))) |
187 return false; | 180 return false; |
188 path->SetPathname(ToUtf8(buffer)); | 181 path->SetPathname(ToUtf8(buffer)); |
189 return true; | 182 return true; |
190 } | 183 } |
191 | 184 |
192 } // namespace rtc | 185 } // namespace rtc |
OLD | NEW |