feat(windows): WIP
This commit is contained in:
@@ -3,6 +3,6 @@ const std = @import("std");
|
||||
pub const os_module = switch (@import("builtin").os.tag) {
|
||||
.linux => @import("linux/linux.zig"),
|
||||
.macos => @import("macos/macos.zig"),
|
||||
.windows => @import("windows/windows.zig"),
|
||||
.windows => @compileError("Windows: WIP"),
|
||||
else => @compileError("Unsupported operating system"),
|
||||
};
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
const std = @import("std");
|
||||
|
||||
pub fn getUsername(allocator: std.mem.Allocator) ![]u8 {
|
||||
const username = try std.process.getEnvVarOwned(allocator, "USERNAME");
|
||||
return username;
|
||||
}
|
||||
// TODO: (2) WIP
|
||||
|
||||
pub fn getHostname(allocator: std.mem.Allocator) ![]u8 {
|
||||
var buf: [std.posix.HOST_NAME_MAX]u8 = undefined;
|
||||
const hostnameEnv = try std.posix.gethostname(&buf);
|
||||
// pub fn getUsername(allocator: std.mem.Allocator) ![]u8 {
|
||||
// const username = try std.process.getEnvVarOwned(allocator, "USERNAME");
|
||||
// return username;
|
||||
// }
|
||||
|
||||
const hostname = try allocator.dupe(u8, hostnameEnv);
|
||||
// pub fn getHostname(allocator: std.mem.Allocator) ![]u8 {
|
||||
// var buf: [std.posix.HOST_NAME_MAX]u8 = undefined;
|
||||
// const hostnameEnv = try std.posix.gethostname(&buf);
|
||||
|
||||
return hostname;
|
||||
}
|
||||
// const hostname = try allocator.dupe(u8, hostnameEnv);
|
||||
|
||||
// return hostname;
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user