- Fix appending to c:\ or \ #2569.

This commit is contained in:
Christoffer Lerno
2025-11-09 21:45:19 +01:00
parent 52ececba37
commit eccc6700dc
3 changed files with 15 additions and 3 deletions

View File

@@ -186,13 +186,11 @@ fn bool Path.equals(self, Path p2) @operator(==)
fn Path? Path.append(self, Allocator allocator, String filename)
{
if (!self.path_string.len) return new(allocator, filename, self.env)!;
assert(!is_separator(self.path_string[^1], self.env));
@pool()
{
DString dstr = dstring::temp_with_capacity(self.path_string.len + 1 + filename.len);
dstr.append(self.path_string);
dstr.append(PREFERRED_SEPARATOR);
if (!is_separator(self.path_string[^1], self.env)) dstr.append(PREFERRED_SEPARATOR);
dstr.append(filename);
return new(allocator, dstr.str_view(), self.env);
};