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

Side by Side Diff: samples/buildhook2/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 | « samples/buildhook2/bin/test.dart ('k') | sdk/lib/io/file.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 import "package:args/args.dart"; 6 import "package:args/args.dart";
7 7
8 bool cleanBuild; 8 bool cleanBuild;
9 bool fullBuild; 9 bool fullBuild;
10 List<String> changedFiles; 10 List<String> changedFiles;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 /** 93 /**
94 * Convert a .foo file to a .foobar file. 94 * Convert a .foo file to a .foobar file.
95 */ 95 */
96 void _processFile(String arg) { 96 void _processFile(String arg) {
97 if (arg.endsWith(".foo")) { 97 if (arg.endsWith(".foo")) {
98 print("processing: ${arg}"); 98 print("processing: ${arg}");
99 99
100 File file = new File(arg); 100 File file = new File(arg);
101 101
102 String contents = file.readAsTextSync(); 102 String contents = file.readAsStringSync();
103 103
104 File outFile = new File("${arg}bar"); 104 File outFile = new File("${arg}bar");
105 105
106 OutputStream out = outFile.openOutputStream(); 106 OutputStream out = outFile.openOutputStream();
107 out.writeString("Processed from ${file.name}:\n"); 107 out.writeString("Processed from ${file.name}:\n");
108 if (contents != null) { 108 if (contents != null) {
109 out.writeString(contents); 109 out.writeString(contents);
110 } 110 }
111 out.close(); 111 out.close();
112 112
113 print("wrote : ${outFile.name}"); 113 print("wrote : ${outFile.name}");
114 } 114 }
115 } 115 }
116 116
117 /** 117 /**
118 * If this file is a generated file (based on the extension), delete it. 118 * If this file is a generated file (based on the extension), delete it.
119 */ 119 */
120 void _maybeClean(String file) { 120 void _maybeClean(String file) {
121 if (file.endsWith(".foobar")) { 121 if (file.endsWith(".foobar")) {
122 new File(file).delete(); 122 new File(file).delete();
123 } 123 }
124 } 124 }
OLDNEW
« no previous file with comments | « samples/buildhook2/bin/test.dart ('k') | sdk/lib/io/file.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698