| OLD | NEW |
| 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 * In order to generate test.foobar, make an edit to test.foo. | 8 * In order to generate test.foobar, make an edit to test.foo. |
| 9 */ | 9 */ |
| 10 void main() { | 10 void main() { |
| 11 printContents("test.foo"); | 11 printContents("test.foo"); |
| 12 print(""); | 12 print(""); |
| 13 printContents("test.foobar"); | 13 printContents("test.foobar"); |
| 14 } | 14 } |
| 15 | 15 |
| 16 void printContents(String file) { | 16 void printContents(String file) { |
| 17 print("the contents of ${file} are:"); | 17 print("the contents of ${file} are:"); |
| 18 | 18 |
| 19 var f = new File(file); | 19 var f = new File(file); |
| 20 | 20 |
| 21 if (f.existsSync()) { | 21 if (f.existsSync()) { |
| 22 String contents = new File(file).readAsTextSync(); | 22 String contents = new File(file).readAsStringSync(); |
| 23 | 23 |
| 24 print("[${contents}]"); | 24 print("[${contents}]"); |
| 25 } else { | 25 } else { |
| 26 print("[]"); | 26 print("[]"); |
| 27 } | 27 } |
| 28 } | 28 } |
| OLD | NEW |