| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // Where | 51 // Where |
| 52 // * platform is either of "win", "mac" or "linux". | 52 // * platform is either of "win", "mac" or "linux". |
| 53 // * architecture is either of "32" or "64". | 53 // * architecture is either of "32" or "64". |
| 54 // | 54 // |
| 55 // Arguments: | 55 // Arguments: |
| 56 // name - Name of the resource file. If a plain filename (no directory path) | 56 // name - Name of the resource file. If a plain filename (no directory path) |
| 57 // is supplied, the file is assumed to be located in resources/ | 57 // is supplied, the file is assumed to be located in resources/ |
| 58 // If a directory path is prepended to the filename, a subdirectory | 58 // If a directory path is prepended to the filename, a subdirectory |
| 59 // hierarchy reflecting that path is assumed to be present. | 59 // hierarchy reflecting that path is assumed to be present. |
| 60 // extension - File extension, without the dot, i.e. "bmp" or "yuv". | 60 // extension - File extension, without the dot, i.e. "bmp" or "yuv". |
| 61 std::string ResourcePath(std::string name, std::string extension); | 61 std::string ResourcePath(const std::string& name, |
| 62 const std::string& extension); |
| 62 | 63 |
| 63 // Gets the current working directory for the executing program. | 64 // Gets the current working directory for the executing program. |
| 64 // Returns "./" if for some reason it is not possible to find the working | 65 // Returns "./" if for some reason it is not possible to find the working |
| 65 // directory. | 66 // directory. |
| 66 std::string WorkingDir(); | 67 std::string WorkingDir(); |
| 67 | 68 |
| 68 // Creates a directory if it not already exists. | 69 // Creates a directory if it not already exists. |
| 69 // Returns true if successful. Will print an error message to stderr and return | 70 // Returns true if successful. Will print an error message to stderr and return |
| 70 // false if a file with the same name already exists. | 71 // false if a file with the same name already exists. |
| 71 bool CreateDir(std::string directory_name); | 72 bool CreateDir(const std::string& directory_name); |
| 72 | 73 |
| 73 // Checks if a file exists. | 74 // Checks if a file exists. |
| 74 bool FileExists(std::string& file_name); | 75 bool FileExists(const std::string& file_name); |
| 75 | 76 |
| 76 // File size of the supplied file in bytes. Will return 0 if the file is | 77 // File size of the supplied file in bytes. Will return 0 if the file is |
| 77 // empty or if the file does not exist/is readable. | 78 // empty or if the file does not exist/is readable. |
| 78 size_t GetFileSize(std::string filename); | 79 size_t GetFileSize(const std::string& filename); |
| 79 | 80 |
| 80 // Sets the executable path, i.e. the path to the executable that is being used | 81 // Sets the executable path, i.e. the path to the executable that is being used |
| 81 // when launching it. This is usually the path relative to the working directory | 82 // when launching it. This is usually the path relative to the working directory |
| 82 // but can also be an absolute path. The intention with this function is to pass | 83 // but can also be an absolute path. The intention with this function is to pass |
| 83 // the argv[0] being sent into the main function to make it possible for | 84 // the argv[0] being sent into the main function to make it possible for |
| 84 // fileutils.h to find the correct project paths even when the working directory | 85 // fileutils.h to find the correct project paths even when the working directory |
| 85 // is outside the project tree (which happens in some cases). | 86 // is outside the project tree (which happens in some cases). |
| 86 void SetExecutablePath(const std::string& path_to_executable); | 87 void SetExecutablePath(const std::string& path_to_executable); |
| 87 | 88 |
| 88 } // namespace test | 89 } // namespace test |
| 89 } // namespace webrtc | 90 } // namespace webrtc |
| 90 | 91 |
| 91 #endif // WEBRTC_TEST_TESTSUPPORT_FILEUTILS_H_ | 92 #endif // WEBRTC_TEST_TESTSUPPORT_FILEUTILS_H_ |
| OLD | NEW |