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

Side by Side Diff: lib/src/template/file_system.dart

Issue 11092092: Support compiling templates in the browser. Base URL: git@github.com:dart-lang/dart-web-components.git@master
Patch Set: Created 8 years, 2 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
« no previous file with comments | « lib/src/template/emitters.dart ('k') | lib/src/template/file_system_browser.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** Abstraction for file systems and utility functions to manipulate paths. */ 7 /** Abstraction for file systems and utility functions to manipulate paths. */
8 library file_system; 8 library file_system;
9 9
10 /** 10 /**
11 * Abstraction around file system access to work in a variety of different 11 * Abstraction around file system access to work in a variety of different
12 * environments. 12 * environments.
13 */ 13 */
14 interface FileSystem { 14 interface FileSystem {
15 String readAll(String filename); 15 /**
16 * Apply all pending writes. Until this method is called, writeString is not
17 * guaranteed to have any observable impact.
18 */
19 Future flush();
16 20
21 Future<String> readAll(String filename);
22
23 /**
24 * Writes [text] to [outfile]. Call flush to insure that changes are visible.
25 */
17 void writeString(String outfile, String text); 26 void writeString(String outfile, String text);
18 27
19 void createDirectory(String path, [bool recursive]); 28 void createDirectory(String path, [bool recursive]);
20 void removeDirectory(String path, [bool recursive]); 29 void removeDirectory(String path, [bool recursive]);
21 } 30 }
22 31
23 /** 32 /**
24 * Replaces all back slashes (\) with forward slashes (/) in [path] and 33 * Replaces all back slashes (\) with forward slashes (/) in [path] and
25 * return the result. 34 * return the result.
26 */ 35 */
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 String basename(String path) { 73 String basename(String path) {
65 path = canonicalizePath(path); 74 path = canonicalizePath(path);
66 75
67 int lastSlash = path.lastIndexOf('/', path.length); 76 int lastSlash = path.lastIndexOf('/', path.length);
68 if (lastSlash == -1) { 77 if (lastSlash == -1) {
69 return path; 78 return path;
70 } else { 79 } else {
71 return path.substring(lastSlash + 1); 80 return path.substring(lastSlash + 1);
72 } 81 }
73 } 82 }
OLDNEW
« no previous file with comments | « lib/src/template/emitters.dart ('k') | lib/src/template/file_system_browser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698