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

Side by Side Diff: packages/path/lib/src/style/posix.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 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 unified diff | Download patch
« no previous file with comments | « packages/path/lib/src/style.dart ('k') | packages/path/lib/src/style/url.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library path.style.posix;
6
7 import '../characters.dart' as chars; 5 import '../characters.dart' as chars;
8 import '../parsed_path.dart'; 6 import '../parsed_path.dart';
9 import '../internal_style.dart'; 7 import '../internal_style.dart';
10 8
11 /// The style for POSIX paths. 9 /// The style for POSIX paths.
12 class PosixStyle extends InternalStyle { 10 class PosixStyle extends InternalStyle {
13 PosixStyle(); 11 PosixStyle();
14 12
15 final name = 'posix'; 13 final name = 'posix';
16 final separator = '/'; 14 final separator = '/';
17 final separators = const ['/']; 15 final separators = const ['/'];
18 16
19 // Deprecated properties. 17 // Deprecated properties.
20 18
21 final separatorPattern = new RegExp(r'/'); 19 final separatorPattern = new RegExp(r'/');
22 final needsSeparatorPattern = new RegExp(r'[^/]$'); 20 final needsSeparatorPattern = new RegExp(r'[^/]$');
23 final rootPattern = new RegExp(r'^/'); 21 final rootPattern = new RegExp(r'^/');
24 final relativeRootPattern = null; 22 final relativeRootPattern = null;
25 23
26 bool containsSeparator(String path) => path.contains('/'); 24 bool containsSeparator(String path) => path.contains('/');
27 25
28 bool isSeparator(int codeUnit) => codeUnit == chars.SLASH; 26 bool isSeparator(int codeUnit) => codeUnit == chars.SLASH;
29 27
30 bool needsSeparator(String path) => 28 bool needsSeparator(String path) =>
31 path.isNotEmpty && !isSeparator(path.codeUnitAt(path.length - 1)); 29 path.isNotEmpty && !isSeparator(path.codeUnitAt(path.length - 1));
32 30
33 int rootLength(String path) { 31 int rootLength(String path, {bool withDrive: false}) {
34 if (path.isNotEmpty && isSeparator(path.codeUnitAt(0))) return 1; 32 if (path.isNotEmpty && isSeparator(path.codeUnitAt(0))) return 1;
35 return 0; 33 return 0;
36 } 34 }
37 35
38 bool isRootRelative(String path) => false; 36 bool isRootRelative(String path) => false;
39 37
40 String getRelativeRoot(String path) => null; 38 String getRelativeRoot(String path) => null;
41 39
42 String pathFromUri(Uri uri) { 40 String pathFromUri(Uri uri) {
43 if (uri.scheme == '' || uri.scheme == 'file') { 41 if (uri.scheme == '' || uri.scheme == 'file') {
(...skipping 11 matching lines...) Expand all
55 parsed.parts.addAll(["", ""]); 53 parsed.parts.addAll(["", ""]);
56 } else if (parsed.hasTrailingSeparator) { 54 } else if (parsed.hasTrailingSeparator) {
57 // If the path has a trailing slash, add a single empty component so the 55 // If the path has a trailing slash, add a single empty component so the
58 // URI has a trailing slash as well. 56 // URI has a trailing slash as well.
59 parsed.parts.add(""); 57 parsed.parts.add("");
60 } 58 }
61 59
62 return new Uri(scheme: 'file', pathSegments: parsed.parts); 60 return new Uri(scheme: 'file', pathSegments: parsed.parts);
63 } 61 }
64 } 62 }
OLDNEW
« no previous file with comments | « packages/path/lib/src/style.dart ('k') | packages/path/lib/src/style/url.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698