Skip to content

Commit 0343cb8

Browse files
committed
Fix typo, clean up
1 parent 820be0f commit 0343cb8

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

build.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn build(b: *std.Build) !void {
2323

2424
const lib = b.addLibrary(.{
2525
.linkage = .static,
26-
.name = try std.fmt.allocPrint(b.allocator, "dll_proxy_{s}", .{@tagName(target.result.abi)}),
26+
.name = "dll_proxy",
2727
.root_module = lib_mod,
2828
});
2929

src/paths.zig

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,23 @@ pub const ModulePathBuf = struct {
1919
}
2020
};
2121

22-
fn splitPath(comptime Char: type, path: []const Char) usize {
22+
pub fn getFileName(comptime Char: type, path: []const Char) []const Char {
2323
if (path.len == 0) {
24-
@panic("Empty path provided to splitPath");
24+
@panic("Empty path provided to getFileName");
2525
}
2626
var i = path.len;
2727
while (true) {
2828
i -= 1;
2929
const c = path[i];
3030
if (c == '/' or c == '\\') {
31-
return .{ .parent = i + 1 };
31+
return path[i + 1 ..];
3232
}
3333
if (i == 0) {
34-
return .{ .parent = 0 };
34+
return path;
3535
}
3636
}
3737
}
3838

39-
pub fn getFileName(comptime Char: type, path: []const Char) []const Char {
40-
return path[splitPath(Char, path)..];
41-
}
42-
4339
test "get_file_name" {
4440
try std.testing.expectEqualStrings("baz", getFileName(u8, "/foo/bar/baz"));
4541
try std.testing.expectEqualStrings("baz.txt", getFileName(u8, "/foo/bar/baz.txt"));

src/root.zig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,7 @@ pub fn loadProxy(module: std.os.windows.HMODULE) !void {
105105

106106
loadFunctions(handle);
107107
}
108+
109+
test {
110+
_ = loadProxy;
111+
}

0 commit comments

Comments
 (0)