| Index: pkg/path/lib/src/internal_style.dart
|
| diff --git a/pkg/path/lib/src/style.dart b/pkg/path/lib/src/internal_style.dart
|
| similarity index 54%
|
| copy from pkg/path/lib/src/style.dart
|
| copy to pkg/path/lib/src/internal_style.dart
|
| index 9da4b43a603a5fd67fdfa5e32a362e11338fc27d..13fb57e1454dac40877690cdf456f24e2aeda630 100644
|
| --- a/pkg/path/lib/src/style.dart
|
| +++ b/pkg/path/lib/src/internal_style.dart
|
| @@ -1,56 +1,18 @@
|
| -// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
| +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| -library path.style;
|
| +library path.internal_style;
|
|
|
| import 'context.dart';
|
| -import 'style/posix.dart';
|
| -import 'style/url.dart';
|
| -import 'style/windows.dart';
|
| -
|
| -/// An enum type describing a "flavor" of path.
|
| -abstract class Style {
|
| - /// POSIX-style paths use "/" (forward slash) as separators. Absolute paths
|
| - /// start with "/". Used by UNIX, Linux, Mac OS X, and others.
|
| - static final posix = new PosixStyle();
|
| -
|
| - /// Windows paths use "\" (backslash) as separators. Absolute paths start with
|
| - /// a drive letter followed by a colon (example, "C:") or two backslashes
|
| - /// ("\\") for UNC paths.
|
| - // TODO(rnystrom): The UNC root prefix should include the drive name too, not
|
| - // just the "\\".
|
| - static final windows = new WindowsStyle();
|
| -
|
| - /// URLs aren't filesystem paths, but they're supported to make it easier to
|
| - /// manipulate URL paths in the browser.
|
| - ///
|
| - /// URLs use "/" (forward slash) as separators. Absolute paths either start
|
| - /// with a protocol and optional hostname (e.g. `http://dartlang.org`,
|
| - /// `file://`) or with "/".
|
| - static final url = new UrlStyle();
|
| -
|
| - /// The style of the host platform.
|
| - ///
|
| - /// When running on the command line, this will be [windows] or [posix] based
|
| - /// on the host operating system. On a browser, this will be [url].
|
| - static final platform = _getPlatformStyle();
|
| -
|
| - /// Gets the type of the host platform.
|
| - static Style _getPlatformStyle() {
|
| - // If we're running a Dart file in the browser from a `file:` URI,
|
| - // [Uri.base] will point to a file. If we're running on the standalone,
|
| - // it will point to a directory. We can use that fact to determine which
|
| - // style to use.
|
| - if (Uri.base.scheme != 'file') return Style.url;
|
| - if (!Uri.base.path.endsWith('/')) return Style.url;
|
| - if (new Uri(path: 'a/b').toFilePath() == 'a\\b') return Style.windows;
|
| - return Style.posix;
|
| - }
|
| -
|
| - /// The name of this path style. Will be "posix" or "windows".
|
| - String get name;
|
| -
|
| +import 'style.dart';
|
| +
|
| +/// The internal interface for the [Style] type.
|
| +///
|
| +/// Users should be able to pass around instances of [Style] like an enum, but
|
| +/// the members that [Context] uses should be hidden from them. Those members
|
| +/// are defined on this class instead.
|
| +abstract class InternalStyle extends Style {
|
| /// The path separator for this style. On POSIX, this is `/`. On Windows,
|
| /// it's `\`.
|
| String get separator;
|
| @@ -81,9 +43,6 @@ abstract class Style {
|
| /// paths.
|
| final Pattern relativeRootPattern = null;
|
|
|
| - /// A [Context] that uses this style.
|
| - Context get context => new Context(style: this);
|
| -
|
| /// Gets the root prefix of [path] if path is absolute. If [path] is relative,
|
| /// returns `null`.
|
| String getRoot(String path) {
|
| @@ -113,6 +72,4 @@ abstract class Style {
|
|
|
| /// Returns the URI that represents [path], which is assumed to be absolute.
|
| Uri absolutePathToUri(String path);
|
| -
|
| - String toString() => name;
|
| }
|
|
|