-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
#14146: Iterate PATH when no /usr/bin/env #18828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I will be adding similar kind of code to ElfDynLib to find system libraries as well. Maybe we could add utility like this to std.fs or std.os ? const SearchPathIterator = struct {
paths: std.mem.TokenIterator(u8, .scalar),
pub fn initPath(path: []const u8) @This() {
return .{ .paths = std.mem.tokenizeScalar(u8, path, ':') };
}
pub fn initEnv(env: []const u8) @This() {
return initPath(std.os.getenv(env) orelse "");
}
pub fn next(self: *@This()) ?[]const u8 {
return self.paths.next();
}
}; (Could have nextWithComponent, to construct the relevant path for you too)
I'm not sure about zig std's status quo, but I wouldn't rely on |
I can't say about adding utility methods. Seems a bit redundant when the code to iterate PATH is already so simple. About |
0391659
to
497211d
Compare
497211d
to
35e0dea
Compare
Sorry for the delay! Have been busy and had no access to my desktop for a bit. I followed the suggestion to use Maybe there are some new issues due to the implemenation changing slightly, don't be afraid to nitpick. |
35e0dea
to
7f635ee
Compare
I'm sorry, I didn't review this in time, and now it has bitrotted. Furthermore, so many pull requests have stacked up that I can't keep up and I am therefore declaring Pull Request Bankruptcy and closing old PRs that now have conflicts with master branch. If you want to reroll, you are by all means welcome to revisit this changeset with respect to the current state of master branch, and there's a decent chance your patch will be reviewed the second time around. Either way, I'm closing this now, otherwise the PR queue will continue to grow indefinitely. |
Understandable! Unfortunate though that it's the second time for the same issue. Haven't been using Termux recently but might create a new PR if I do. |
It is indeed unfortunate, however I think in this case it is because someone else made a related change, so your change might not be necessary anymore and needs to be re-evaluated, or at least reintegrated. Anyway my point is that progress has been made. |
Another go at #14146, following @andrewrk's latest comment.
Am still pretty fresh at Zig stdlib code so feedback appreciated (e.g. is
FixedBufferAllocator
the best way here?)