mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-04-12 10:48:39 +03:00
Merge pull request #2733 from jparise/path_sep
os: replace PATH_SEP with std.fs.path.delimiter
This commit is contained in:
@ -3,12 +3,6 @@ const builtin = @import("builtin");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const posix = std.posix;
|
||||
|
||||
/// The separator used in environment variables such as PATH.
|
||||
pub const PATH_SEP = switch (builtin.os.tag) {
|
||||
.windows => ";",
|
||||
else => ":",
|
||||
};
|
||||
|
||||
/// Append a value to an environment variable such as PATH.
|
||||
/// The returned value is always allocated so it must be freed.
|
||||
pub fn appendEnv(
|
||||
@ -33,9 +27,9 @@ pub fn appendEnvAlways(
|
||||
current: []const u8,
|
||||
value: []const u8,
|
||||
) ![]u8 {
|
||||
return try std.fmt.allocPrint(alloc, "{s}{s}{s}", .{
|
||||
return try std.fmt.allocPrint(alloc, "{s}{c}{s}", .{
|
||||
current,
|
||||
PATH_SEP,
|
||||
std.fs.path.delimiter,
|
||||
value,
|
||||
});
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ pub const windows = @import("windows.zig");
|
||||
// Functions and types
|
||||
pub const CFReleaseThread = @import("cf_release_thread.zig");
|
||||
pub const TempDir = @import("TempDir.zig");
|
||||
pub const PATH_SEP = env.PATH_SEP;
|
||||
pub const appendEnv = env.appendEnv;
|
||||
pub const appendEnvAlways = env.appendEnvAlways;
|
||||
pub const getenv = env.getenv;
|
||||
|
@ -780,7 +780,7 @@ const Subprocess = struct {
|
||||
// then we just set it to the directory of the binary.
|
||||
if (env.get("PATH")) |path| {
|
||||
// Verify that our path doesn't already contain this entry
|
||||
var it = std.mem.tokenizeScalar(u8, path, internal_os.PATH_SEP[0]);
|
||||
var it = std.mem.tokenizeScalar(u8, path, std.fs.path.delimiter);
|
||||
while (it.next()) |entry| {
|
||||
if (std.mem.eql(u8, entry, exe_dir)) break :ghostty_path;
|
||||
}
|
||||
|
Reference in New Issue
Block a user