In order to land https://codereview.webrtc.org/2790933002/ and due to the
ongoing clean-up work (see https://codereview.webrtc.org/2887093002,
https://codereview.webrtc.org/2894583002/ and
https://codereview.webrtc.org/2891923002/), ReadDirectory() has been
added in webrtc/test/testsupport/fileutils.h.
BUG=NOBUG
Review-Url: https://codereview.webrtc.org/2898753002
Cr-Commit-Position: refs/heads/master@{#18369}
diff --git a/webrtc/test/testsupport/fileutils.h b/webrtc/test/testsupport/fileutils.h
index 2135681..434287d 100644
--- a/webrtc/test/testsupport/fileutils.h
+++ b/webrtc/test/testsupport/fileutils.h
@@ -14,6 +14,9 @@
#define WEBRTC_TEST_TESTSUPPORT_FILEUTILS_H_
#include <string>
+#include <vector>
+
+#include "webrtc/base/optional.h"
namespace webrtc {
namespace test {
@@ -66,6 +69,12 @@
// directory.
std::string WorkingDir();
+// Reads the content of a directory and, in case of success, returns a vector
+// of strings with one element for each found file or directory. Each element is
+// a path created by prepending |dir| to the file/directory name. "." and ".."
+// are never added in the returned vector.
+rtc::Optional<std::vector<std::string>> ReadDirectory(std::string path);
+
// Creates a directory if it not already exists.
// Returns true if successful. Will print an error message to stderr and return
// false if a file with the same name already exists.