struct Options [src]
Fields
exclude_extensions: []const []const u8 = &.{}File paths that end in any of these suffixes will be excluded from copying.
include_extensions: ?[]const []const u8 = nullOnly file paths that end in any of these suffixes will be included in copying.
null means that all suffixes will be included.
exclude_extensions takes precedence over include_extensions.
Members
- dupe (Function)
- pathIncluded (Function)
Source
pub const Options = struct {
/// File paths that end in any of these suffixes will be excluded from copying.
exclude_extensions: []const []const u8 = &.{},
/// Only file paths that end in any of these suffixes will be included in copying.
/// `null` means that all suffixes will be included.
/// `exclude_extensions` takes precedence over `include_extensions`.
include_extensions: ?[]const []const u8 = null,
pub fn dupe(opts: Options, b: *std.Build) Options {
return .{
.exclude_extensions = b.dupeStrings(opts.exclude_extensions),
.include_extensions = if (opts.include_extensions) |incs| b.dupeStrings(incs) else null,
};
}
pub fn pathIncluded(opts: Options, path: []const u8) bool {
for (opts.exclude_extensions) |ext| {
if (std.mem.endsWith(u8, path, ext))
return false;
}
if (opts.include_extensions) |incs| {
for (incs) |inc| {
if (std.mem.endsWith(u8, path, inc))
return true;
} else {
return false;
}
}
return true;
}
}