Merge pull request #404 from leecannon/builtin_changes
Update to use @import("builtin") where required
This commit is contained in:
commit
44fb88b85b
@ -1 +1 @@
|
|||||||
Subproject commit 234b589d3cd0c00f2f675f98fd9674e208fd2bd0
|
Subproject commit a282c26da51e5d2c01fec5c744e321ae248cf409
|
@ -1,4 +1,5 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
const zig_builtin = @import("builtin");
|
||||||
const build_options = @import("build_options");
|
const build_options = @import("build_options");
|
||||||
const Config = @import("./config.zig");
|
const Config = @import("./config.zig");
|
||||||
const DocumentStore = @import("./document_store.zig");
|
const DocumentStore = @import("./document_store.zig");
|
||||||
@ -29,7 +30,7 @@ const logger = std.log.scoped(.main);
|
|||||||
// value in the definition below.
|
// value in the definition below.
|
||||||
pub const log_level = .debug;
|
pub const log_level = .debug;
|
||||||
|
|
||||||
var actual_log_level: std.log.Level = switch (std.builtin.mode) {
|
var actual_log_level: std.log.Level = switch (zig_builtin.mode) {
|
||||||
.Debug => .debug,
|
.Debug => .debug,
|
||||||
else => .notice,
|
else => .notice,
|
||||||
};
|
};
|
||||||
@ -1654,7 +1655,7 @@ fn processJsonRpc(arena: *std.heap.ArenaAllocator, parser: *std.json.Parser, jso
|
|||||||
logger.debug("Method without return value not implemented: {s}", .{method});
|
logger.debug("Method without return value not implemented: {s}", .{method});
|
||||||
}
|
}
|
||||||
|
|
||||||
const stack_frames = switch (std.builtin.mode) {
|
const stack_frames = switch (zig_builtin.mode) {
|
||||||
.Debug => 10,
|
.Debug => 10,
|
||||||
else => 0,
|
else => 0,
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
const builtin = @import("builtin");
|
||||||
const zinput = @import("zinput");
|
const zinput = @import("zinput");
|
||||||
const known_folders = @import("known-folders");
|
const known_folders = @import("known-folders");
|
||||||
|
|
||||||
@ -72,7 +73,7 @@ pub fn wizard(allocator: *std.mem.Allocator) !void {
|
|||||||
print("Found zig executable '{s}' in PATH.\n", .{path});
|
print("Found zig executable '{s}' in PATH.\n", .{path});
|
||||||
} else {
|
} else {
|
||||||
write("Could not find 'zig' in PATH\n");
|
write("Could not find 'zig' in PATH\n");
|
||||||
zig_exe_path = try zinput.askString(allocator, if (std.builtin.os.tag == .windows)
|
zig_exe_path = try zinput.askString(allocator, if (builtin.os.tag == .windows)
|
||||||
\\What is the path to the 'zig' executable you would like to use?
|
\\What is the path to the 'zig' executable you would like to use?
|
||||||
\\Note that due to a bug in zig (https://github.com/ziglang/zig/issues/6044),
|
\\Note that due to a bug in zig (https://github.com/ziglang/zig/issues/6044),
|
||||||
\\your zig directory cannot contain the '/' character.
|
\\your zig directory cannot contain the '/' character.
|
||||||
@ -221,13 +222,13 @@ pub fn findZig(allocator: *std.mem.Allocator) !?[]const u8 {
|
|||||||
};
|
};
|
||||||
defer allocator.free(env_path);
|
defer allocator.free(env_path);
|
||||||
|
|
||||||
const exe_extension = std.Target.current.exeFileExt();
|
const exe_extension = builtin.target.exeFileExt();
|
||||||
const zig_exe = try std.fmt.allocPrint(allocator, "zig{s}", .{exe_extension});
|
const zig_exe = try std.fmt.allocPrint(allocator, "zig{s}", .{exe_extension});
|
||||||
defer allocator.free(zig_exe);
|
defer allocator.free(zig_exe);
|
||||||
|
|
||||||
var it = std.mem.tokenize(u8, env_path, &[_]u8{std.fs.path.delimiter});
|
var it = std.mem.tokenize(u8, env_path, &[_]u8{std.fs.path.delimiter});
|
||||||
while (it.next()) |path| {
|
while (it.next()) |path| {
|
||||||
if (std.builtin.os.tag == .windows) {
|
if (builtin.os.tag == .windows) {
|
||||||
if (std.mem.indexOfScalar(u8, path, '/') != null) continue;
|
if (std.mem.indexOfScalar(u8, path, '/') != null) continue;
|
||||||
}
|
}
|
||||||
const full_path = try std.fs.path.join(allocator, &[_][]const u8{ path, zig_exe });
|
const full_path = try std.fs.path.join(allocator, &[_][]const u8{ path, zig_exe });
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
const builtin = @import("builtin");
|
||||||
|
|
||||||
// http://tools.ietf.org/html/rfc3986#section-2.2
|
// http://tools.ietf.org/html/rfc3986#section-2.2
|
||||||
const reserved_chars = &[_]u8{
|
const reserved_chars = &[_]u8{
|
||||||
@ -20,7 +21,7 @@ const reserved_escapes = blk: {
|
|||||||
/// Returns a URI from a path, caller owns the memory allocated with `allocator`
|
/// Returns a URI from a path, caller owns the memory allocated with `allocator`
|
||||||
pub fn fromPath(allocator: *std.mem.Allocator, path: []const u8) ![]const u8 {
|
pub fn fromPath(allocator: *std.mem.Allocator, path: []const u8) ![]const u8 {
|
||||||
if (path.len == 0) return "";
|
if (path.len == 0) return "";
|
||||||
const prefix = if (std.builtin.os.tag == .windows) "file:///" else "file://";
|
const prefix = if (builtin.os.tag == .windows) "file:///" else "file://";
|
||||||
|
|
||||||
var buf = std.ArrayList(u8).init(allocator);
|
var buf = std.ArrayList(u8).init(allocator);
|
||||||
try buf.appendSlice(prefix);
|
try buf.appendSlice(prefix);
|
||||||
@ -36,7 +37,7 @@ pub fn fromPath(allocator: *std.mem.Allocator, path: []const u8) ![]const u8 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// On windows, we need to lowercase the drive name.
|
// On windows, we need to lowercase the drive name.
|
||||||
if (std.builtin.os.tag == .windows) {
|
if (builtin.os.tag == .windows) {
|
||||||
if (buf.items.len > prefix.len + 1 and
|
if (buf.items.len > prefix.len + 1 and
|
||||||
std.ascii.isAlpha(buf.items[prefix.len]) and
|
std.ascii.isAlpha(buf.items[prefix.len]) and
|
||||||
std.mem.startsWith(u8, buf.items[prefix.len + 1 ..], "%3A"))
|
std.mem.startsWith(u8, buf.items[prefix.len + 1 ..], "%3A"))
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 0622255c35a8fbe7d09c8d45f357cec776bd2e3a
|
Subproject commit 56da848c9aa8b5637114acff48576773a0ee998e
|
@ -1,7 +1,8 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const headerPkg = @import("header");
|
const headerPkg = @import("header");
|
||||||
|
const builtin = @import("builtin");
|
||||||
|
|
||||||
const suffix = if (std.builtin.os.tag == .windows) ".exe" else "";
|
const suffix = if (builtin.os.tag == .windows) ".exe" else "";
|
||||||
const allocator = std.heap.page_allocator;
|
const allocator = std.heap.page_allocator;
|
||||||
|
|
||||||
const initialize_msg =
|
const initialize_msg =
|
||||||
|
Loading…
Reference in New Issue
Block a user