Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: webrtc/test/testsupport/fileutils.cc

Issue 2749163003: FileUtilsTest DirExists function added (Closed)
Patch Set: OS-generic test Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/test/testsupport/fileutils.h ('k') | webrtc/test/testsupport/fileutils_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 temp_path = temp_path.substr(0, temp_path.find_last_of(kPathDelimiter)); 99 temp_path = temp_path.substr(0, temp_path.find_last_of(kPathDelimiter));
100 strncpy(relative_dir_path, temp_path.c_str(), FILENAME_MAX); 100 strncpy(relative_dir_path, temp_path.c_str(), FILENAME_MAX);
101 relative_dir_path_set = true; 101 relative_dir_path_set = true;
102 } 102 }
103 103
104 bool FileExists(const std::string& file_name) { 104 bool FileExists(const std::string& file_name) {
105 struct stat file_info = {0}; 105 struct stat file_info = {0};
106 return stat(file_name.c_str(), &file_info) == 0; 106 return stat(file_name.c_str(), &file_info) == 0;
107 } 107 }
108 108
109 bool DirExists(const std::string& directory_name) {
110 struct stat directory_info = {0};
111 return stat(directory_name.c_str(), &directory_info) == 0 && S_ISDIR(
112 directory_info.st_mode);
113 }
114
109 #ifdef WEBRTC_ANDROID 115 #ifdef WEBRTC_ANDROID
110 116
111 std::string ProjectRootPath() { 117 std::string ProjectRootPath() {
112 return kRootDirName; 118 return kRootDirName;
113 } 119 }
114 120
115 std::string OutputPath() { 121 std::string OutputPath() {
116 return kRootDirName; 122 return kRootDirName;
117 } 123 }
118 124
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 if (fseek(f, 0, SEEK_END) == 0) { 284 if (fseek(f, 0, SEEK_END) == 0) {
279 size = ftell(f); 285 size = ftell(f);
280 } 286 }
281 fclose(f); 287 fclose(f);
282 } 288 }
283 return size; 289 return size;
284 } 290 }
285 291
286 } // namespace test 292 } // namespace test
287 } // namespace webrtc 293 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/test/testsupport/fileutils.h ('k') | webrtc/test/testsupport/fileutils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698