Skip to content

Commit

Permalink
src: reduce unnecessary GetCwd calls
Browse files Browse the repository at this point in the history
PR-URL: nodejs#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 sophonieb committed Jun 20, 2024
1 parent b23c493 commit 557f87d
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 557f87d

Please sign in to comment.