Skip to content

fix/refactor: fix lookup logic and small refactor (remove redundant std::filesystem calls) - #16580

Merged
vaxerski merged 3 commits into
hyprwm:mainfrom
b1tflyyyy:fix/executableExistsInPath
Oct 19, 2026
Merged

vaxerski merged 3 commits into
hyprwm:mainfrom
b1tflyyyy:fix/executableExistsInPath

Conversation

@b1tflyyyy

Copy link
Copy Markdown
Contributor

Describe your PR, what does it fix/add?

  1. Removed redundant calls (std::filesystem, std::getenv) and simplified lookup logic.
  2. Fixed lookup logic:
    Before:
    If file matches, but does not have std::filesystem::perms::others_exec the code returns false and stops lookup.

After:
Fixed, code continues search for exe file.

Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)

No.

Did you use AI in any way shape or form in the making of this PR? If so, detail how you used it. (Undisclosed AI use is a violation of the AI Policy and is punishable)

No.

Is it ready for merging, or does it need work?

Ready for mergin.

Comment thread src/helpers/fs/FsUtils.cpp Fixed
Comment thread src/helpers/fs/FsUtils.cpp Outdated
Comment thread src/helpers/fs/FsUtils.cpp Outdated

bool NFsUtils::executableExistsInPath(const std::string& exe) {
if (!getenv("PATH"))
const char* const path = std::getenv("PATH");
@b1tflyyyy

Copy link
Copy Markdown
Contributor Author

I rethought this a bit and changed this:

    if (!fullPath.ends_with('/')) {
        fullPath.push_back('/');
    }

    fullPath += exe;

to:

        fullPath = dir;
        fullPath /= exe;

since std::filesystem::path can correctly handle extra '/' cppref

@b1tflyyyy
b1tflyyyy requested a review from vaxerski October 18, 2026 08:40
@vaxerski
vaxerski merged commit 12f2425 into hyprwm:main Oct 19, 2026
10 checks passed
hegjon pushed a commit to hegjon/hypoland that referenced this pull request Oct 20, 2026
…filesystem calls) (hyprwm#16580)

* fix lookup logic and small refactor (remove redundant std::filesystem calls)

* replace CVarList with CVarList2

* fix if

(cherry picked from commit 12f2425)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants