fix(windows): encode colons in project state file path

This commit is contained in:
CJ van den Berg 2024-08-08 22:27:58 +02:00
parent 5eeeb837ad
commit 8abc9c0ee1

View file

@ -401,13 +401,14 @@ const Process = struct {
error.PathAlreadyExists => {}, error.PathAlreadyExists => {},
else => return e, else => return e,
}; };
var pos: usize = 0; for (path) |c| {
while (std.mem.indexOfScalarPos(u8, path, pos, std.fs.path.sep)) |next| { _ = if (std.fs.path.isSep(c))
_ = try writer.write(path[pos..next]); try writer.write("__")
_ = try writer.write("__"); else if (c == ':')
pos = next + 1; try writer.write("___")
else
try writer.writeByte(c);
} }
_ = try writer.write(path[pos..]);
return stream.toOwnedSlice(); return stream.toOwnedSlice();
} }
}; };