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 // TODO(terry): Investigate common library for file I/O shared between frog and
tools. | 5 // TODO(terry): Investigate common library for file I/O shared between frog and
tools. |
6 | 6 |
7 #library('file_system_vm'); | 7 library file_system_vm; |
8 #import('dart:io'); | 8 import 'dart:io'; |
9 #import('file_system.dart'); | 9 import 'file_system.dart'; |
10 #import('dart:utf'); | 10 import 'dart:utf'; |
11 | 11 |
12 /** File system implementation using the vm api's. */ | 12 /** File system implementation using the vm api's. */ |
13 class VMFileSystem implements FileSystem { | 13 class VMFileSystem implements FileSystem { |
14 void writeString(String path, String text) { | 14 void writeString(String path, String text) { |
15 var file = new File(path).openSync(FileMode.WRITE); | 15 var file = new File(path).openSync(FileMode.WRITE); |
16 file.writeStringSync(text); | 16 file.writeStringSync(text); |
17 file.closeSync(); | 17 file.closeSync(); |
18 } | 18 } |
19 | 19 |
20 String readAll(String filename) { | 20 String readAll(String filename) { |
(...skipping 12 matching lines...) Expand all Loading... |
33 void createDirectory(String path, [bool recursive = false]) { | 33 void createDirectory(String path, [bool recursive = false]) { |
34 // TODO(rnystrom): Implement. | 34 // TODO(rnystrom): Implement. |
35 throw 'createDirectory() is not implemented by VMFileSystem yet.'; | 35 throw 'createDirectory() is not implemented by VMFileSystem yet.'; |
36 } | 36 } |
37 | 37 |
38 void removeDirectory(String path, [bool recursive = false]) { | 38 void removeDirectory(String path, [bool recursive = false]) { |
39 // TODO(rnystrom): Implement. | 39 // TODO(rnystrom): Implement. |
40 throw 'removeDirectory() is not implemented by VMFileSystem yet.'; | 40 throw 'removeDirectory() is not implemented by VMFileSystem yet.'; |
41 } | 41 } |
42 } | 42 } |
OLD | NEW |