| OLD | NEW |
| 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 |
| 11 #include "webrtc/test/testsupport/fileutils.h" | 11 #include "webrtc/test/testsupport/fileutils.h" |
| 12 | 12 |
| 13 #include <assert.h> | 13 #include <assert.h> |
| 14 | 14 |
| 15 #ifdef WIN32 | 15 #ifdef WIN32 |
| 16 #include <direct.h> | 16 #include <direct.h> |
| 17 #include <tchar.h> | 17 #include <tchar.h> |
| 18 #include <windows.h> | 18 #include <windows.h> |
| 19 #include <algorithm> | 19 #include <algorithm> |
| 20 | 20 |
| 21 #include "Shlwapi.h" | 21 #include "Shlwapi.h" |
| 22 #include "WinDef.h" |
| 22 | 23 |
| 23 #include "webrtc/system_wrappers/include/utf_util_win.h" | 24 #include "webrtc/system_wrappers/include/utf_util_win.h" |
| 24 #define GET_CURRENT_DIR _getcwd | 25 #define GET_CURRENT_DIR _getcwd |
| 25 #else | 26 #else |
| 26 #include <unistd.h> | 27 #include <unistd.h> |
| 27 | 28 |
| 28 #define GET_CURRENT_DIR getcwd | 29 #define GET_CURRENT_DIR getcwd |
| 29 #endif | 30 #endif |
| 30 | 31 |
| 31 #include <sys/stat.h> // To check for directory existence. | 32 #include <sys/stat.h> // To check for directory existence. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 std::string path = WorkingDir(); | 129 std::string path = WorkingDir(); |
| 129 if (path == kFallbackPath) { | 130 if (path == kFallbackPath) { |
| 130 return kCannotFindProjectRootDir; | 131 return kCannotFindProjectRootDir; |
| 131 } | 132 } |
| 132 if (relative_dir_path_set) { | 133 if (relative_dir_path_set) { |
| 133 path = path + kPathDelimiter + relative_dir_path; | 134 path = path + kPathDelimiter + relative_dir_path; |
| 134 } | 135 } |
| 135 path = path + kPathDelimiter + ".." + kPathDelimiter + ".."; | 136 path = path + kPathDelimiter + ".." + kPathDelimiter + ".."; |
| 136 char canonical_path[FILENAME_MAX]; | 137 char canonical_path[FILENAME_MAX]; |
| 137 #ifdef WIN32 | 138 #ifdef WIN32 |
| 138 bool succeeded = PathCanonicalizeA(canonical_path, path.c_str()); | 139 BOOL succeeded = PathCanonicalizeA(canonical_path, path.c_str()); |
| 139 #else | 140 #else |
| 140 bool succeeded = realpath(path.c_str(), canonical_path) != NULL; | 141 bool succeeded = realpath(path.c_str(), canonical_path) != NULL; |
| 141 #endif | 142 #endif |
| 142 if (succeeded) { | 143 if (succeeded) { |
| 143 path = std::string(canonical_path) + kPathDelimiter; | 144 path = std::string(canonical_path) + kPathDelimiter; |
| 144 return path; | 145 return path; |
| 145 } else { | 146 } else { |
| 146 fprintf(stderr, "Cannot find project root directory!\n"); | 147 fprintf(stderr, "Cannot find project root directory!\n"); |
| 147 return kCannotFindProjectRootDir; | 148 return kCannotFindProjectRootDir; |
| 148 } | 149 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 if (fseek(f, 0, SEEK_END) == 0) { | 277 if (fseek(f, 0, SEEK_END) == 0) { |
| 277 size = ftell(f); | 278 size = ftell(f); |
| 278 } | 279 } |
| 279 fclose(f); | 280 fclose(f); |
| 280 } | 281 } |
| 281 return size; | 282 return size; |
| 282 } | 283 } |
| 283 | 284 |
| 284 } // namespace test | 285 } // namespace test |
| 285 } // namespace webrtc | 286 } // namespace webrtc |
| OLD | NEW |