mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
os: replace PATH_SEP with std.fs.path.delimiter
This standard library symbol is equivalent.
This commit is contained in:
@ -3,12 +3,6 @@ const builtin = @import("builtin");
|
|||||||
const Allocator = std.mem.Allocator;
|
const Allocator = std.mem.Allocator;
|
||||||
const posix = std.posix;
|
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.
|
/// Append a value to an environment variable such as PATH.
|
||||||
/// The returned value is always allocated so it must be freed.
|
/// The returned value is always allocated so it must be freed.
|
||||||
pub fn appendEnv(
|
pub fn appendEnv(
|
||||||
@ -33,9 +27,9 @@ pub fn appendEnvAlways(
|
|||||||
current: []const u8,
|
current: []const u8,
|
||||||
value: []const u8,
|
value: []const u8,
|
||||||
) ![]u8 {
|
) ![]u8 {
|
||||||
return try std.fmt.allocPrint(alloc, "{s}{s}{s}", .{
|
return try std.fmt.allocPrint(alloc, "{s}{c}{s}", .{
|
||||||
current,
|
current,
|
||||||
PATH_SEP,
|
std.fs.path.delimiter,
|
||||||
value,
|
value,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ pub const windows = @import("windows.zig");
|
|||||||
// Functions and types
|
// Functions and types
|
||||||
pub const CFReleaseThread = @import("cf_release_thread.zig");
|
pub const CFReleaseThread = @import("cf_release_thread.zig");
|
||||||
pub const TempDir = @import("TempDir.zig");
|
pub const TempDir = @import("TempDir.zig");
|
||||||
pub const PATH_SEP = env.PATH_SEP;
|
|
||||||
pub const appendEnv = env.appendEnv;
|
pub const appendEnv = env.appendEnv;
|
||||||
pub const appendEnvAlways = env.appendEnvAlways;
|
pub const appendEnvAlways = env.appendEnvAlways;
|
||||||
pub const getenv = env.getenv;
|
pub const getenv = env.getenv;
|
||||||
|
@ -780,7 +780,7 @@ const Subprocess = struct {
|
|||||||
// then we just set it to the directory of the binary.
|
// then we just set it to the directory of the binary.
|
||||||
if (env.get("PATH")) |path| {
|
if (env.get("PATH")) |path| {
|
||||||
// Verify that our path doesn't already contain this entry
|
// 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| {
|
while (it.next()) |entry| {
|
||||||
if (std.mem.eql(u8, entry, exe_dir)) break :ghostty_path;
|
if (std.mem.eql(u8, entry, exe_dir)) break :ghostty_path;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user