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

Unified Diff: samples/buildhook2/build.dart

Issue 12316036: Merge IO v2 branch to bleeding edge (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased to r18818 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samples/buildhook1/build.dart ('k') | samples/chat/chat_server_lib.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/buildhook2/build.dart
diff --git a/samples/buildhook2/build.dart b/samples/buildhook2/build.dart
index cb48843b38827e8e40d2f71f122fa478a0b53431..a7e0198ae04e83e63ca0e5845df076d562350675 100644
--- a/samples/buildhook2/build.dart
+++ b/samples/buildhook2/build.dart
@@ -70,7 +70,9 @@ void processArgs() {
*/
void handleCleanCommand() {
Directory current = new Directory.current();
- current.list(recursive: true).onFile = _maybeClean;
+ current.list(recursive: true).listen((entity) {
+ if (entity.isFile) _maybeClean(entity.path)
+ });
}
/**
@@ -78,10 +80,11 @@ void handleCleanCommand() {
*/
void handleFullBuild() {
var files = <String>[];
- var lister = new Directory.current().list(recursive: true);
-
- lister.onFile = (file) => files.add(file);
- lister.onDone = (_) => handleChangedFiles(files);
+ new Directory.current().list(recursive: true).listen(
+ (entity) {
+ if (entity.isFile) files.add(entity.path);
+ },
+ onDone: () => handleChangedFiles(files));
}
/**
@@ -111,10 +114,10 @@ void _processFile(String arg) {
File outFile = new File("${arg}bar");
- OutputStream out = outFile.openOutputStream();
- out.writeString("// processed from ${file.name}:\n");
+ var out = outFile.openWrite();
+ out.addString("// processed from ${file.name}:\n");
if (contents != null) {
- out.writeString(contents);
+ out.addString(contents);
}
out.close();
« no previous file with comments | « samples/buildhook1/build.dart ('k') | samples/chat/chat_server_lib.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698