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..f28aad53589137b632101d15953a713d222df269 100644 |
--- a/pkg/path/lib/src/context.dart |
+++ b/pkg/path/lib/src/context.dart |
@@ -23,12 +23,8 @@ class Context { |
/// On the browser, [style] defaults to [Style.url] and [current] defaults to |
/// the current URL. |
factory Context({Style style, String current}) { |
- if (current == null) { |
- if (style == null) { |
- current = p.current; |
- } else { |
- current = "."; |
- } |
+ if (current == null && style != null) { |
+ current = "."; |
} |
if (style == null) { |
@@ -41,13 +37,17 @@ class Context { |
return new Context._(style, current); |
} |
- Context._(this.style, this.current); |
+ Context._(this.style, this._current); |
/// The style of path that this context works with. |
final InternalStyle style; |
+ /// The current given when Context was created. If null, current should be |
Bob Nystrom
2014/07/30 16:15:08
"current" -> "current directory".
"should be" ->
Anders Johnsen
2014/07/31 06:19:42
Done.
|
+ /// evaluated from 'p.current'. |
+ final String _current; |
+ |
/// The current directory that relative paths will be relative to. |
Bob Nystrom
2014/07/30 16:15:08
"will be" -> "are".
Anders Johnsen
2014/07/31 06:19:42
Done.
|
- final String current; |
+ 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 `\`. |