Skip to content

Commit

Permalink
src: reduce unnecessary GetCwd calls
Browse files Browse the repository at this point in the history
PR-URL: #53064
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
  • Loading branch information
anonrig authored and marco-ippolito committed Jul 19, 2024
1 parent faa347a commit 0701ba4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,7 @@ std::string PathResolve(Environment* env,
const size_t numArgs = paths.size();

for (int i = numArgs - 1; i >= -1 && !resolvedAbsolute; i--) {
const std::string& path =
(i >= 0) ? std::string(paths[i]) : env->GetCwd(env->exec_path());
const std::string& path = (i >= 0) ? std::string(paths[i]) : cwd;

if (!path.empty()) {
resolvedPath = std::string(path) + "/" + resolvedPath;
Expand Down

0 comments on commit 0701ba4

Please sign in to comment.