@@ -60,13 +60,14 @@ class ChrootFileSystem extends FileSystem {
6060 String get _localRoot => p.rootPrefix (root);
6161
6262 @override
63- Directory directory (path) => new _ChrootDirectory (this , common.getPath (path));
63+ Directory directory (dynamic path) =>
64+ new _ChrootDirectory (this , common.getPath (path));
6465
6566 @override
66- File file (path) => new _ChrootFile (this , common.getPath (path));
67+ File file (dynamic path) => new _ChrootFile (this , common.getPath (path));
6768
6869 @override
69- Link link (path) => new _ChrootLink (this , common.getPath (path));
70+ Link link (dynamic path) => new _ChrootLink (this , common.getPath (path));
7071
7172 @override
7273 p.Context get path =>
@@ -99,7 +100,7 @@ class ChrootFileSystem extends FileSystem {
99100 /// Gets the path context for this file system given the current working dir.
100101
101102 @override
102- set currentDirectory (path) {
103+ set currentDirectory (dynamic path) {
103104 String value;
104105 if (path is io.Directory ) {
105106 value = path.path;
@@ -109,7 +110,7 @@ class ChrootFileSystem extends FileSystem {
109110 throw new ArgumentError ('Invalid type for "path": ${path ?.runtimeType }' );
110111 }
111112
112- value = _resolve (value, notFound: _NotFoundBehavior .THROW );
113+ value = _resolve (value, notFound: _NotFoundBehavior .throwError );
113114 String realPath = _real (value, resolve: false );
114115 switch (delegate.typeSync (realPath, followLinks: false )) {
115116 case FileSystemEntityType .DIRECTORY :
@@ -128,7 +129,7 @@ class ChrootFileSystem extends FileSystem {
128129 try {
129130 path = _resolve (path);
130131 } on FileSystemException {
131- return new Future .value (const _NotFoundFileStat ());
132+ return new Future < FileStat > .value (const _NotFoundFileStat ());
132133 }
133134 return delegate.stat (_real (path, resolve: false ));
134135 }
@@ -164,7 +165,8 @@ class ChrootFileSystem extends FileSystem {
164165 try {
165166 realPath = _real (path, followLinks: followLinks);
166167 } on FileSystemException {
167- return new Future .value (FileSystemEntityType .NOT_FOUND );
168+ return new Future <FileSystemEntityType >.value (
169+ FileSystemEntityType .NOT_FOUND );
168170 }
169171 return delegate.type (realPath, followLinks: false );
170172 }
@@ -244,14 +246,20 @@ class ChrootFileSystem extends FileSystem {
244246 /// only if [followLinks] is `true` . Symbolic links found in the middle of
245247 /// the path will always be resolved.
246248 ///
247- /// If [throwIfNotFound] is `true` , and the path cannot be resolved, a file
248- /// system exception is thrown - otherwise the resolution will halt and the
249- /// partially resolved path will be returned.
249+ /// If the path cannot be resolved, and [notFound] is:
250+ /// - [_NotFoundBehavior.throwError] : a [FileSystemException] is thrown.
251+ /// - [_NotFoundBehavior.mkdir] : the path will be created as needed.
252+ /// - [_NotFoundBehavior.allowAtTail] : a [FileSystemException] is thrown,
253+ /// unless only the *tail* path element cannot be resolved, in which case
254+ /// the resolution will halt at the tail element, and the partially
255+ /// resolved path will be returned.
256+ /// - [_NotFoundBehavior.allow] (the default), the resolution will halt and
257+ /// the partially resolved path will be returned.
250258 String _resolve (
251259 String path, {
252260 String from,
253261 bool followLinks: true ,
254- _NotFoundBehavior notFound: _NotFoundBehavior .ALLOW ,
262+ _NotFoundBehavior notFound: _NotFoundBehavior .allow ,
255263 }) {
256264 p.Context ctx = _context;
257265 String root = _localRoot;
@@ -304,19 +312,19 @@ class ChrootFileSystem extends FileSystem {
304312 }
305313
306314 switch (notFound) {
307- case _NotFoundBehavior .MKDIR :
315+ case _NotFoundBehavior .mkdir :
308316 if (parts.isNotEmpty) {
309317 delegate.directory (realPath).createSync ();
310318 }
311319 break ;
312- case _NotFoundBehavior .ALLOW :
320+ case _NotFoundBehavior .allow :
313321 return returnEarly ();
314- case _NotFoundBehavior .ALLOW_AT_TAIL :
322+ case _NotFoundBehavior .allowAtTail :
315323 if (parts.isEmpty) {
316324 return returnEarly ();
317325 }
318326 throw notFoundException ();
319- case _NotFoundBehavior .THROW :
327+ case _NotFoundBehavior .throwError :
320328 throw notFoundException ();
321329 }
322330 break ;
@@ -351,10 +359,10 @@ class _ChrootJailException implements IOException {}
351359
352360/// What to do when `NOT_FOUND` paths are encountered while resolving.
353361enum _NotFoundBehavior {
354- ALLOW ,
355- ALLOW_AT_TAIL ,
356- THROW ,
357- MKDIR ,
362+ allow ,
363+ allowAtTail ,
364+ throwError ,
365+ mkdir ,
358366}
359367
360368/// A [FileStat] representing a `NOT_FOUND` entity.
0 commit comments