Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(701)

Unified Diff: pkg/path/lib/src/context.dart

Issue 429173002: Don't cache path Context based on cwd, as cwd involves a system-call to compute. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Cleanup. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/path/lib/path.dart ('k') | pkg/path/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/path/lib/src/context.dart
diff --git a/pkg/path/lib/src/context.dart b/pkg/path/lib/src/context.dart
index 823e0c28402d83b6b7db1e0f305174be5ac303f7..eecb1df96111013eabac749ac51ac303e8f01e9a 100644
--- a/pkg/path/lib/src/context.dart
+++ b/pkg/path/lib/src/context.dart
@@ -41,13 +41,20 @@ class Context {
return new Context._(style, current);
}
- Context._(this.style, this.current);
+ /// Create a [Context] to be used internally within path.
+ Context.internal() : style = Style.platform;
Bob Nystrom 2014/08/01 16:32:07 Since _current is final, don't you need to initial
Anders Johnsen 2014/08/04 06:33:14 It's auto-initialized to null.
Anders Johnsen 2014/08/04 06:58:07 Ha, nice one Anders... You are of cause right - fi
+
+ Context._(this.style, this._current);
/// The style of path that this context works with.
final InternalStyle style;
- /// The current directory that relative paths will be relative to.
- final String current;
+ /// The current directory given when Context was created. If null, current
+ /// directory is evaluated from 'p.current'.
+ final String _current;
+
+ /// The current directory that relative paths are relative to.
+ String get current => _current != null ? _current : p.current;
/// Gets the path separator for the context's [style]. On Mac and Linux,
/// this is `/`. On Windows, it's `\`.
« no previous file with comments | « pkg/path/lib/path.dart ('k') | pkg/path/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698