aboutsummaryrefslogtreecommitdiff
path: root/src/fs.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs.zig')
-rw-r--r--src/fs.zig11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/fs.zig b/src/fs.zig
index dd5029b40..a7eb5d02e 100644
--- a/src/fs.zig
+++ b/src/fs.zig
@@ -955,11 +955,12 @@ pub const PathName = struct {
// so if dir does not have a trailing slash, but is spaced one apart from the basename
// we can assume there is a trailing slash there
// so we extend the original slice's length by one
- if (this.dir[this.dir.len - 1] != std.fs.path.sep_posix and (@ptrToInt(this.dir.ptr) + this.dir.len + 1) == @ptrToInt(this.base.ptr)) {
- return this.dir.ptr[0 .. this.dir.len + 1];
- }
-
- return this.dir;
+ return this.dir.ptr[0 .. this.dir.len + @intCast(
+ usize,
+ @boolToInt(
+ this.dir[this.dir.len - 1] != std.fs.path.sep_posix and (@ptrToInt(this.dir.ptr) + this.dir.len + 1) == @ptrToInt(this.base.ptr),
+ ),
+ )];
}
pub fn init(_path: string) PathName {