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

Side by Side Diff: samples/buildhook1/build.dart

Issue 11412033: Rename File.readAsText to File.readAsString. There is no Text type in Dart (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 | « pkg/intl/lib/src/file_data_reader.dart ('k') | samples/buildhook1/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 import "dart:io"; 5 import "dart:io";
6 6
7 /** 7 /**
8 * This minimal build script copies the contents of .foo files to .foobar files. 8 * This minimal build script copies the contents of .foo files to .foobar files.
9 * In order to be invoked automatically by the Editor, this script must be named 9 * In order to be invoked automatically by the Editor, this script must be named
10 * 'build.dart' and placed in the root of a project. 10 * 'build.dart' and placed in the root of a project.
11 */ 11 */
12 void main() { 12 void main() {
13 for (String arg in new Options().arguments) { 13 for (String arg in new Options().arguments) {
14 if (arg.startsWith("--changed=")) { 14 if (arg.startsWith("--changed=")) {
15 String file = arg.substring("--changed=".length); 15 String file = arg.substring("--changed=".length);
16 16
17 if (file.endsWith(".foo")) { 17 if (file.endsWith(".foo")) {
18 _processFile(file); 18 _processFile(file);
19 } 19 }
20 } 20 }
21 } 21 }
22 } 22 }
23 23
24 void _processFile(String file) { 24 void _processFile(String file) {
25 String contents = new File(file).readAsTextSync(); 25 String contents = new File(file).readAsStringSync();
26 26
27 if (contents != null) { 27 if (contents != null) {
28 OutputStream out = new File("${file}bar").openOutputStream(); 28 OutputStream out = new File("${file}bar").openOutputStream();
29 out.writeString("// processed from ${file}:\n${contents}"); 29 out.writeString("// processed from ${file}:\n${contents}");
30 out.close(); 30 out.close();
31 } 31 }
32 } 32 }
OLDNEW
« no previous file with comments | « pkg/intl/lib/src/file_data_reader.dart ('k') | samples/buildhook1/test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698