Skip to content

Commit 25ad2e2

Browse files
cleanup: Replace use of getcwd with current_path. (#152)
1 parent e0cef5a commit 25ad2e2

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

common/common.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <cxxabi.h>
1212
#include <dirent.h>
1313
#include <exception>
14+
#include <filesystem>
1415
#include <memory>
1516
#include <sys/param.h>
1617
#include <vector>
@@ -89,9 +90,7 @@ bool sorbet::FileOps::ensureDir(string_view path) {
8990
}
9091

9192
std::string sorbet::FileOps::getCurrentDir() {
92-
char buf[MAXPATHLEN + 1];
93-
getcwd(buf, sizeof(buf));
94-
return std::string(buf);
93+
return std::filesystem::current_path();
9594
}
9695

9796
void sorbet::FileOps::removeDir(string_view path) {

0 commit comments

Comments
 (0)