@@ -545,6 +545,9 @@ class _OptionValueWithContext<T> {
545
545
/// built in to these classes so that file existence can be verified, types
546
546
/// constrained, and defaults provided.
547
547
///
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
+ ///
548
551
/// Use via implementations [DartdocOptionSet] , [DartdocOptionArgFile] ,
549
552
/// [DartdocOptionArgOnly] , and [DartdocOptionFileOnly] .
550
553
abstract class DartdocOption <T > {
@@ -727,10 +730,13 @@ abstract class DartdocOption<T> {
727
730
/// Calls [valueAt] with the working directory at the start of the program.
728
731
T valueAtCurrent () => valueAt (_directoryCurrent);
729
732
733
+ Folder __directoryCurrent;
730
734
Folder get _directoryCurrent =>
731
- resourceProvider.getFolder (resourceProvider.pathContext.current );
735
+ __directoryCurrent ?? = resourceProvider.getFolder (_directoryCurrentPath );
732
736
733
- String get _directoryCurrentPath => resourceProvider.pathContext.current;
737
+ String __directoryCurrentPath;
738
+ String get _directoryCurrentPath =>
739
+ __directoryCurrentPath ?? = resourceProvider.pathContext.current;
734
740
735
741
/// Calls [valueAt] on the directory this element is defined in.
736
742
T valueAtElement (Element element) =>
0 commit comments