Application Context Implementation #4

Closed
kayomn wants to merge 93 commits from event-loop-dev into main
1 changed files with 27 additions and 14 deletions
Showing only changes of commit d2f4c0afe1 - Show all commits

View File

@ -550,7 +550,10 @@ pub const FileSystem = enum {
.length = 0, .length = 0,
}; };
for (sequences) |sequence| if (sequence.len != 0) { if (sequences.len != 0) {
const last_sequence_index = sequences.len - 1;
for (sequences) |sequence, index| if (sequence.len != 0) {
var components = mem.Spliterator(u8){ var components = mem.Spliterator(u8){
.source = sequence, .source = sequence,
.delimiter = "/", .delimiter = "/",
@ -564,12 +567,22 @@ pub const FileSystem = enum {
path.length += 1; path.length += 1;
} }
if (components.hasNext()) {
if (path.length == Path.max) return error.TooLong; if (path.length == Path.max) return error.TooLong;
path.buffer[path.length] = '/'; path.buffer[path.length] = '/';
path.length += 1; path.length += 1;
}
}; };
if (index < last_sequence_index) {
if (path.length == Path.max) return error.TooLong;
path.buffer[path.length] = '/';
path.length += 1;
}
}; };
}
return path; return path;
} }