MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / GetCurrentDir

Method GetCurrentDir

tests/gtest/gtest-all.cc:9331–9351  ·  view source on GitHub ↗

Returns the current working directory, or "" if unsuccessful.

Source from the content-addressed store, hash-verified

9329
9330// Returns the current working directory, or "" if unsuccessful.
9331FilePath FilePath::GetCurrentDir() {
9332#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || \
9333 GTEST_OS_WINDOWS_RT || ARDUINO
9334 // Windows CE and Arduino don't have a current directory, so we just return
9335 // something reasonable.
9336 return FilePath(kCurrentDirectoryString);
9337#elif GTEST_OS_WINDOWS
9338 char cwd[GTEST_PATH_MAX_ + 1] = { '\0' };
9339 return FilePath(_getcwd(cwd, sizeof(cwd)) == nullptr ? "" : cwd);
9340#else
9341 char cwd[GTEST_PATH_MAX_ + 1] = { '\0' };
9342 char* result = getcwd(cwd, sizeof(cwd));
9343# if GTEST_OS_NACL
9344 // getcwd will likely fail in NaCl due to the sandbox, so return something
9345 // reasonable. The user may have provided a shim implementation for getcwd,
9346 // however, so fallback only when failure is detected.
9347 return FilePath(result == nullptr ? kCurrentDirectoryString : cwd);
9348# endif // GTEST_OS_NACL
9349 return FilePath(result == nullptr ? "" : cwd);
9350#endif // GTEST_OS_WINDOWS_MOBILE
9351}
9352
9353// Returns a copy of the FilePath with the case-insensitive extension removed.
9354// Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns

Callers

nothing calls this directly

Calls 1

FilePathFunction · 0.85

Tested by

no test coverage detected