mirror of
https://github.com/google/googletest.git
synced 2026-06-15 08:26:11 +08:00
Merge 2c4147e2e954d500e1b772474f294342907fb4f7 into 7140cd416cecd7462a8aae488024abeee55598e4
This commit is contained in:
commit
6d8fa41cf5
@ -109,7 +109,10 @@ FilePath FilePath::GetCurrentDir() {
|
||||
return FilePath(kCurrentDirectoryString);
|
||||
#elif defined(GTEST_OS_WINDOWS)
|
||||
char cwd[GTEST_PATH_MAX_ + 1] = {'\0'};
|
||||
return FilePath(_getcwd(cwd, sizeof(cwd)) == nullptr ? "" : cwd);
|
||||
if (_getcwd(cwd, sizeof(cwd)) == nullptr) return {};
|
||||
auto len = std::strlen(cwd);
|
||||
if (len > 0 && cwd[len - 1] == '\\') cwd[--len] = 0;
|
||||
return FilePath({cwd, len});
|
||||
#else
|
||||
char cwd[GTEST_PATH_MAX_ + 1] = {'\0'};
|
||||
char* result = getcwd(cwd, sizeof(cwd));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user