summaryrefslogtreecommitdiff
path: root/gtest/gtest-utils.cpp
diff options
context:
space:
mode:
authorJonathan Wright <jonathan.wright@arm.com>2020-07-16 13:02:47 +0100
committerJonathan Wright <jonathan.wright@arm.com>2020-07-23 19:16:52 +0100
commit0241a1304fd183ee24fbdfe6891f18fdedea38f9 (patch)
treed310d7e74f3f66d42108f708557e81e8959da885 /gtest/gtest-utils.cpp
parentab7cd970a83609f98e8542cea8b81e8d92ddab83 (diff)
Fix file path manipulation on Windows
File path manipulation code introduced in previous commits only supported char_t[]-based POSIX pathnames. This commit adds support for wchar_t[]-based Windows pathnames. Bug: 993876 Change-Id: Ie51eb0a18063ad3209779d9a799309e7a7cd729e
Diffstat (limited to 'gtest/gtest-utils.cpp')
-rw-r--r--gtest/gtest-utils.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/gtest/gtest-utils.cpp b/gtest/gtest-utils.cpp
index 442c2ac..b6df7ab 100644
--- a/gtest/gtest-utils.cpp
+++ b/gtest/gtest-utils.cpp
@@ -18,8 +18,16 @@
* 3. This notice may not be removed or altered from any source distribution.
*/
+#include "base/strings/utf_string_conversions.h"
#include "gtest-utils.h"
+#if defined(OS_WIN)
+std::wstring GetTargetDirectory() {
+ base::FilePath path;
+ base::PathService::Get(base::DIR_CURRENT, &path);
+ return base::UTF8ToWide(path.MaybeAsASCII());
+}
+#else
std::string GetTargetDirectory() {
#if defined(ANDROID)
return "/sdcard";
@@ -29,6 +37,7 @@ std::string GetTargetDirectory() {
return path.MaybeAsASCII();
#endif
}
+#endif
void GetTestFilePath(base::FilePath* path, const std::string filename) {
ASSERT_TRUE(base::PathService::Get(base::DIR_SOURCE_ROOT, path));