aboutsummaryrefslogtreecommitdiff
path: root/src/fs.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-06-29 01:34:38 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-06-29 01:34:38 -0700
commitece2a3ccfd34f9d3c0bb5d8ac8b85a1dec9568f9 (patch)
tree7ba6ab6121f8ced5ca164f5b365925aa7bffd6f9 /src/fs.zig
parent70126c074f8d29a5c1767e0830907e736a30febe (diff)
downloadbun-ece2a3ccfd34f9d3c0bb5d8ac8b85a1dec9568f9.tar.gz
bun-ece2a3ccfd34f9d3c0bb5d8ac8b85a1dec9568f9.tar.zst
bun-ece2a3ccfd34f9d3c0bb5d8ac8b85a1dec9568f9.zip
alright now it crashes
Former-commit-id: 26745bb5f300481fc242c8e81de6f252f698c863
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 {