@@ -545,6 +545,9 @@ class _OptionValueWithContext<T> {
545545/// built in to these classes so that file existence can be verified, types
546546/// constrained, and defaults provided.
547547///
548+ /// This class caches the current working directory from the [ResourceProvider] ;
549+ /// do not attempt to change it during the life of an instance.
550+ ///
548551/// Use via implementations [DartdocOptionSet] , [DartdocOptionArgFile] ,
549552/// [DartdocOptionArgOnly] , and [DartdocOptionFileOnly] .
550553abstract class DartdocOption <T > {
@@ -727,10 +730,13 @@ abstract class DartdocOption<T> {
727730 /// Calls [valueAt] with the working directory at the start of the program.
728731 T valueAtCurrent () => valueAt (_directoryCurrent);
729732
733+ Folder __directoryCurrent;
730734 Folder get _directoryCurrent =>
731- resourceProvider.getFolder (resourceProvider.pathContext.current );
735+ __directoryCurrent ?? = resourceProvider.getFolder (_directoryCurrentPath );
732736
733- String get _directoryCurrentPath => resourceProvider.pathContext.current;
737+ String __directoryCurrentPath;
738+ String get _directoryCurrentPath =>
739+ __directoryCurrentPath ?? = resourceProvider.pathContext.current;
734740
735741 /// Calls [valueAt] on the directory this element is defined in.
736742 T valueAtElement (Element element) =>
0 commit comments