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 <rlau@redhat.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
  • Loading branch information
anonrig authored and marco-ippolito committed Jul 19, 2024
1 parent af226d0 commit 32839c6
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 32839c6

Please sign in to comment.