PathMeta constructor
PathMeta(})
Implementation
PathMeta(
String location, {
this.pattern = r'**',
this.excludes = 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,
sizes: sizes,
times: times,
),
);
}
}