PathMeta constructor
PathMeta(
- String location, {
- String pattern = r'**',
- List<
String> excludes = const [], - List<
String> mimeOverrides = const [], - List<
String> mimeIncludes = const [], - List<
String> mimeExcludes = const [], - List<
int> sizes = const [], - List<
DateTime> times = const [], - Map<
String, String> env = const {}, - bool verbose = false,
- bool cancelOnError = true,
- String os = '',
- StatTimeType statTimeType = StatTimeType.modified,
Implementation
PathMeta(
String location, {
this.pattern = r'**',
this.excludes = const [],
this.mimeOverrides = const [],
this.mimeIncludes = const [],
this.mimeExcludes = const [],
this.sizes = const [],
this.times = const [],
this.env = const {},
this.verbose = false,
this.cancelOnError = true,
this.os = '',
this.statTimeType = StatTimeType.modified,
}) : path = location {
// env = {...Platform.environment, ...env}; // merage env
if (verbose) {
logger = CliVerboseLogger(ansi: CliAnsi(CliAnsi.isSupportAnsi));
}
if (os.isEmpty) os = Platform.operatingSystem;
if (path.contains(varInputRegexp)) path = expandVar(path, map: env);
if (path.contains(r'~')) path = expandTilde(path);
if (pattern.contains(varInputRegexp)) {
pattern = expandVar(pattern, map: env);
}
if (excludes.isNotEmpty) {
var excl = excludes
.map((e) => e.contains(varInputRegexp) ? expandVar(e, map: env) : e);
excludes = excl.toList();
}
// if (path.startsWith(r'.')) path = expandDotPath(path);
path = p.normalize(path);
type = FileSystemEntity.typeSync(path);
// print('location:$location, path:$path');
Stream<FileSystemEntity>? fseStream_;
if (type == FileSystemEntityType.directory) {
fseStream_ = Glob(pattern).list(root: path);
}
if (type == FileSystemEntityType.file) {
fseStream_ = Stream.value(File(path));
}
if (fseStream_ != null) {
fseStream = fseStream_.cast<FileSystemEntity>().transform(
EntityStreamTransformer(
scEntity,
scFilted,
cancelOnError: cancelOnError,
excludes: excludes,
mimeOverrides: mimeOverrides,
mimeIncludes: mimeIncludes,
mimeExcludes: mimeExcludes,
sizes: sizes,
times: times,
),
);
}
}