diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /third_party/libwebrtc/test/testsupport/file_utils.cc | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/test/testsupport/file_utils.cc')
-rw-r--r-- | third_party/libwebrtc/test/testsupport/file_utils.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/third_party/libwebrtc/test/testsupport/file_utils.cc b/third_party/libwebrtc/test/testsupport/file_utils.cc index 47fed9ac05..afabbaad3f 100644 --- a/third_party/libwebrtc/test/testsupport/file_utils.cc +++ b/third_party/libwebrtc/test/testsupport/file_utils.cc @@ -36,7 +36,7 @@ #include <sys/stat.h> // To check for directory existence. #ifndef S_ISDIR // Not defined in stat.h on Windows. -#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR) +#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) #endif #include <stdio.h> @@ -54,6 +54,7 @@ #include "absl/strings/string_view.h" #include "rtc_base/checks.h" +#include "rtc_base/helpers.h" #include "rtc_base/string_utils.h" #include "rtc_base/strings/string_builder.h" #include "test/testsupport/file_utils_override.h" @@ -94,6 +95,13 @@ std::string OutputPath() { return webrtc::test::internal::OutputPath(); } +std::string OutputPathWithRandomDirectory() { + std::string path = webrtc::test::internal::OutputPath(); + std::string rand_dir = path + rtc::CreateRandomUuid(); + + return CreateDir(rand_dir) ? rand_dir + std::string(kPathDelimiter) : path; +} + std::string WorkingDir() { return webrtc::test::internal::WorkingDir(); } @@ -229,7 +237,12 @@ std::string ResourcePath(absl::string_view name, absl::string_view extension) { std::string JoinFilename(absl::string_view dir, absl::string_view name) { RTC_CHECK(!dir.empty()) << "Special cases not implemented."; rtc::StringBuilder os; - os << dir << kPathDelimiter << name; + os << dir; + // If the directory path already ends with a path delimiter don't append it + if (dir.back() != kPathDelimiter.back()) { + os << kPathDelimiter; + } + os << name; return os.Release(); } |