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

Unified Diff: pkg/analyzer_experimental/bin/formatter.dart

Issue 23726002: Path fixes for formatter main. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer_experimental/bin/formatter.dart
===================================================================
--- pkg/analyzer_experimental/bin/formatter.dart (revision 26807)
+++ pkg/analyzer_experimental/bin/formatter.dart (working copy)
@@ -7,12 +7,13 @@
import 'dart:io';
import 'package:args/args.dart';
+import 'package:path/path.dart' as path;
Bob Nystrom 2013/08/28 18:18:55 Don't forget to add path to your pubspec.yaml too
pquitslund 2013/08/28 20:29:13 Already there! :)
import 'package:analyzer_experimental/src/services/formatter_impl.dart';
const BINARY_NAME = 'dartfmt';
-const DART_EXT = '.dart';
+final DART_FILE_REGEXP = new RegExp(r'^[^.].*\.dart$', caseSensitive: false);
Bob Nystrom 2013/08/28 18:18:55 Should be "dartFileRegExp" now since it isn't cons
pquitslund 2013/08/28 20:29:13 Done.
final argParser = _initArgParser();
void main() {
@@ -51,8 +52,6 @@
void _formatFile(file) {
- Uri.parse(file).pathSegments.last;
- print(file.path);
if (_isDartFile(file)) {
try {
var buffer = new StringBuffer();
@@ -66,8 +65,7 @@
}
}
-//TODO(pquitslund): fix this using 'path'
-_isDartFile(file) => !file.path.startsWith('.') && file.path.endsWith(DART_EXT);
+_isDartFile(file) => DART_FILE_REGEXP.hasMatch(path.basename(file.path));
_formatStdin(options) {
_log('not supported yet!');
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698