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 library console; | 5 library console; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 import 'dart:utf'; | 8 import 'dart:utf'; |
9 import 'package:web_components/src/file_system.dart'; | 9 import 'package:web_ui/src/file_system.dart'; |
10 import 'path.dart' as internal; | 10 import 'path.dart' as internal; |
11 | 11 |
12 /** File system implementation for console VM (i.e. no browser). */ | 12 /** File system implementation for console VM (i.e. no browser). */ |
13 class ConsoleFileSystem implements FileSystem { | 13 class ConsoleFileSystem implements FileSystem { |
14 | 14 |
15 /** Pending futures for file write requests. */ | 15 /** Pending futures for file write requests. */ |
16 List<Future> _pending = <Future>[]; | 16 List<Future> _pending = <Future>[]; |
17 | 17 |
18 Future flush() { | 18 Future flush() { |
19 return Futures.wait(_pending).transform((_) { | 19 return Futures.wait(_pending).transform((_) { |
(...skipping 27 matching lines...) Expand all Loading... |
47 .chain((_) => file.close()) | 47 .chain((_) => file.close()) |
48 .transform((_) => buffer); | 48 .transform((_) => buffer); |
49 })); | 49 })); |
50 } | 50 } |
51 | 51 |
52 // TODO(jmesserly): do we support any encoding other than UTF-8 for Dart? | 52 // TODO(jmesserly): do we support any encoding other than UTF-8 for Dart? |
53 Future<String> readText(internal.Path path) { | 53 Future<String> readText(internal.Path path) { |
54 return readTextOrBytes(path).transform(decodeUtf8); | 54 return readTextOrBytes(path).transform(decodeUtf8); |
55 } | 55 } |
56 } | 56 } |
OLD | NEW |