sandbox method
File system sandboxing Directory from an optional path, null meaning currentDirectory, If the original is a sandbox, the tree is sanitized (i.e. never 2 levels of sandboxing.
Implementation
FileSystem sandbox({String? path}) {
var self = this;
if (self is FsShimSandboxedFileSystem) {
if (path == null) {
return self;
}
var delegateFs = self.rootDirectory.fs;
var delegatePath = self.delegatePath(path);
return FsShimSandboxedFileSystemImpl(
rootDirectory: delegateFs.directory(delegatePath),
);
}
var absPath = p.normalize(
path == null ? currentDirectory.path : absolutePath(path),
);
/*
if (this is FsShimSandboxedFileSystem) {
return FsShimSandboxedFileSystemImpl(rootDirectory: directory(absPath));
}
var normalizedRootPath = this.path.normalize(this.path.absolute(absPath));*/
return FsShimSandboxedFileSystemImpl(rootDirectory: directory(absPath));
}