Mock out GetCurrentDir in NaCl.
This commit is contained in:
parent
b54098a9ab
commit
64df8e349f
@ -106,7 +106,14 @@ FilePath FilePath::GetCurrentDir() {
|
|||||||
return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
|
return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
|
||||||
#else
|
#else
|
||||||
char cwd[GTEST_PATH_MAX_ + 1] = { '\0' };
|
char cwd[GTEST_PATH_MAX_ + 1] = { '\0' };
|
||||||
return FilePath(getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
|
char* result = getcwd(cwd, sizeof(cwd));
|
||||||
|
# if GTEST_OS_NACL
|
||||||
|
// getcwd will likely fail in NaCl due to the sandbox, so return something
|
||||||
|
// reasonable. The user may have provided a shim implementation for getcwd,
|
||||||
|
// however, so fallback only when failure is detected.
|
||||||
|
return FilePath(result == NULL ? kCurrentDirectoryString : cwd);
|
||||||
|
# endif // GTEST_OS_NACL
|
||||||
|
return FilePath(result == NULL ? "" : cwd);
|
||||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
#endif // GTEST_OS_WINDOWS_MOBILE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user