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

Side by Side Diff: frog/file_system.dart

Issue 8572044: Clean and create output directory when generating docs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Git rid of need for grid-22.png. Created 9 years, 1 month 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 | « no previous file | frog/file_system_dom.dart » ('j') | frog/file_system_dom.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 /** Abstraction for file systems and utility functions to manipulate paths. */ 5 /** Abstraction for file systems and utility functions to manipulate paths. */
6 #library('file_system'); 6 #library('file_system');
7 7
8 /** 8 /**
9 * Abstraction around file system access to work in a variety of different 9 * Abstraction around file system access to work in a variety of different
10 * environments. 10 * environments.
11 */ 11 */
12 interface FileSystem { 12 interface FileSystem {
13 String readAll(String filename); 13 String readAll(String filename);
14 14
15 void writeString(String outfile, String text); 15 void writeString(String outfile, String text);
16 16
17 bool fileExists(String filename); 17 bool fileExists(String filename);
18
19 void createDirectory(String path, [bool recursive]);
20 void removeDirectory(String path, [bool recursive]);
18 } 21 }
19 22
20 /** Join [path1] to [path2]. */ 23 /** Join [path1] to [path2]. */
21 String joinPaths(String path1, String path2) { 24 String joinPaths(String path1, String path2) {
22 var pieces = path1.split('/'); 25 var pieces = path1.split('/');
23 for (var piece in path2.split('/')) { 26 for (var piece in path2.split('/')) {
24 if (piece == '..' && pieces.length > 0 && pieces.last() != '.' 27 if (piece == '..' && pieces.length > 0 && pieces.last() != '.'
25 && pieces.last() != '..') { 28 && pieces.last() != '..') {
26 pieces.removeLast(); 29 pieces.removeLast();
27 } else if (piece != '') { 30 } else if (piece != '') {
(...skipping 18 matching lines...) Expand all
46 49
47 /** Returns the file name without directory for the [path]. */ 50 /** Returns the file name without directory for the [path]. */
48 String basename(String path) { 51 String basename(String path) {
49 int lastSlash = path.lastIndexOf('/', path.length); 52 int lastSlash = path.lastIndexOf('/', path.length);
50 if (lastSlash == -1) { 53 if (lastSlash == -1) {
51 return path; 54 return path;
52 } else { 55 } else {
53 return path.substring(lastSlash + 1); 56 return path.substring(lastSlash + 1);
54 } 57 }
55 } 58 }
OLDNEW
« no previous file with comments | « no previous file | frog/file_system_dom.dart » ('j') | frog/file_system_dom.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698