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

Side by Side Diff: utils/pub/validator/name.dart

Issue 12253054: Get rid of join() and encapsulate File and Directory in io.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase. Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « utils/pub/validator/lib.dart ('k') | utils/tests/pub/io_test.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 name_validator; 5 library name_validator;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import '../../../pkg/path/lib/path.dart' as path; 10 import '../../../pkg/path/lib/path.dart' as path;
(...skipping 30 matching lines...) Expand all
41 warnings.add('The name of "${libraries[0]}", "$libName", should match ' 41 warnings.add('The name of "${libraries[0]}", "$libName", should match '
42 'the name of the package, "${entrypoint.root.name}".\n' 42 'the name of the package, "${entrypoint.root.name}".\n'
43 'This helps users know what library to import.'); 43 'This helps users know what library to import.');
44 } 44 }
45 }); 45 });
46 } 46 }
47 47
48 /// Returns a list of all libraries in the current package as paths relative 48 /// Returns a list of all libraries in the current package as paths relative
49 /// to the package's root directory. 49 /// to the package's root directory.
50 Future<List<String>> get _libraries { 50 Future<List<String>> get _libraries {
51 var libDir = join(entrypoint.root.dir, "lib"); 51 var libDir = path.join(entrypoint.root.dir, "lib");
52 return defer(() { 52 return defer(() {
53 if (!dirExists(libDir)) return []; 53 if (!dirExists(libDir)) return [];
54 return listDir(libDir, recursive: true); 54 return listDir(libDir, recursive: true);
55 }).then((files) { 55 }).then((files) {
56 return files 56 return files
57 .map((file) => path.relative(file, from: path.dirname(libDir))) 57 .map((file) => path.relative(file, from: path.dirname(libDir)))
58 .where((file) => !path.split(file).contains("src") && 58 .where((file) => !path.split(file).contains("src") &&
59 path.extension(file) == '.dart') 59 path.extension(file) == '.dart')
60 .toList(); 60 .toList();
61 }); 61 });
(...skipping 25 matching lines...) Expand all
87 builder 87 builder
88 ..add(source.substring(lastMatchEnd, match.start + 1)) 88 ..add(source.substring(lastMatchEnd, match.start + 1))
89 ..add("_") 89 ..add("_")
90 ..add(match.group(1).toLowerCase()); 90 ..add(match.group(1).toLowerCase());
91 lastMatchEnd = match.end; 91 lastMatchEnd = match.end;
92 } 92 }
93 builder.add(source.substring(lastMatchEnd)); 93 builder.add(source.substring(lastMatchEnd));
94 return builder.toString().toLowerCase(); 94 return builder.toString().toLowerCase();
95 } 95 }
96 } 96 }
OLDNEW
« no previous file with comments | « utils/pub/validator/lib.dart ('k') | utils/tests/pub/io_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698