nextFilename
Function parameters
Parameters
- self:*Diagnostics
- name:[]const u8
Type definitions in this namespace
Types
Extract the zipped files to the given `dest` directory.
Functions
- extract
- Extract the zipped files to the given `dest` directory.
= [4]u8{ 'P', 'K', 1, 2 }
Values
- central_file_header_sig
- = [4]u8{ 'P', 'K', 1, 2 }
- local_file_header_sig
- = [4]u8{ 'P', 'K', 3, 4 }
- end_record_sig
- = [4]u8{ 'P', 'K', 5, 6 }
- end_record64_sig
- = [4]u8{ 'P', 'K', 6, 6 }
- end_locator64_sig
- = [4]u8{ 'P', 'K', 6, 7 }
Source
Implementation
pub fn nextFilename(self: *Diagnostics, name: []const u8) error{OutOfMemory}!void {
if (!self.saw_first_file) {
self.saw_first_file = true;
std.debug.assert(self.root_dir.len == 0);
const root_len = std.mem.indexOfScalar(u8, name, '/') orelse return;
std.debug.assert(root_len > 0);
self.root_dir = try self.allocator.dupe(u8, name[0..root_len]);
} else if (self.root_dir.len > 0) {
if (!filenameInRoot(name, self.root_dir)) {
self.allocator.free(self.root_dir);
self.root_dir = "";
}
}
}