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

Side by Side Diff: utils/lib/file_system_vm.dart

Issue 9695048: Template parser (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Siggi's comments Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/lib/file_system_memory.dart ('k') | utils/template/codegen.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 // TODO(terry): Investigate common library for file I/O shared between frog and tools.
6
7 #library('file_system_vm');
8 #import('dart:io');
9 #import('file_system.dart');
10 #import('dart:utf');
11
12 /** File system implementation using the vm api's. */
13 class VMFileSystem implements FileSystem {
14 void writeString(String path, String text) {
15 var file = new File(path).openSync(FileMode.WRITE);
16 file.writeStringSync(text);
17 file.closeSync();
18 }
19
20 String readAll(String filename) {
21 var file = (new File(filename)).openSync();
22 var length = file.lengthSync();
23 var buffer = new List<int>(length);
24 var bytes = file.readListSync(buffer, 0, length);
25 file.closeSync();
26 return new String.fromCharCodes(new Utf8Decoder(buffer).decodeRest());
27 }
28
29 bool fileExists(String filename) {
30 return new File(filename).existsSync();
31 }
32
33 void createDirectory(String path, [bool recursive = false]) {
34 // TODO(rnystrom): Implement.
35 throw 'createDirectory() is not implemented by VMFileSystem yet.';
36 }
37
38 void removeDirectory(String path, [bool recursive = false]) {
39 // TODO(rnystrom): Implement.
40 throw 'removeDirectory() is not implemented by VMFileSystem yet.';
41 }
42 }
OLDNEW
« no previous file with comments | « utils/lib/file_system_memory.dart ('k') | utils/template/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698