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

Side by Side Diff: pkg/analyzer/lib/file_system/file_system.dart

Issue 2733053002: Add support for copying directory structures (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/file_system/memory_file_system.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 analyzer.file_system.file_system; 5 library analyzer.file_system.file_system;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analyzer/src/generated/source.dart'; 9 import 'package:analyzer/src/generated/source.dart';
10 import 'package:analyzer/src/util/absolute_path.dart'; 10 import 'package:analyzer/src/util/absolute_path.dart';
(...skipping 14 matching lines...) Expand all
25 * Throws a [FileSystemException] if the operation fails. 25 * Throws a [FileSystemException] if the operation fails.
26 */ 26 */
27 int get lengthSync; 27 int get lengthSync;
28 28
29 /** 29 /**
30 * Return the last-modified stamp of the file. 30 * Return the last-modified stamp of the file.
31 * Throws a [FileSystemException] if the file does not exist. 31 * Throws a [FileSystemException] if the file does not exist.
32 */ 32 */
33 int get modificationStamp; 33 int get modificationStamp;
34 34
35 @override
36 File copyTo(Folder parentFolder);
37
35 /** 38 /**
36 * Create a new [Source] instance that serves this file. 39 * Create a new [Source] instance that serves this file.
37 */ 40 */
38 Source createSource([Uri uri]); 41 Source createSource([Uri uri]);
39 42
40 /** 43 /**
41 * Synchronously read the entire file contents as a list of bytes. 44 * Synchronously read the entire file contents as a list of bytes.
42 * Throws a [FileSystemException] if the operation fails. 45 * Throws a [FileSystemException] if the operation fails.
43 */ 46 */
44 List<int> readAsBytesSync(); 47 List<int> readAsBytesSync();
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 * However, regardless of whether [path] is relative or absolute, normalize 110 * However, regardless of whether [path] is relative or absolute, normalize
108 * it by removing path components of the form '.' or '..'. 111 * it by removing path components of the form '.' or '..'.
109 */ 112 */
110 String canonicalizePath(String path); 113 String canonicalizePath(String path);
111 114
112 /** 115 /**
113 * Return `true` if absolute [path] references a resource in this folder. 116 * Return `true` if absolute [path] references a resource in this folder.
114 */ 117 */
115 bool contains(String path); 118 bool contains(String path);
116 119
120 @override
121 Folder copyTo(Folder parentFolder);
122
123 /**
124 * If this folder does not already exist, create it.
125 */
126 void create();
127
117 /** 128 /**
118 * Return an existing child [Resource] with the given [relPath]. 129 * Return an existing child [Resource] with the given [relPath].
119 * Return a not existing [File] if no such child exist. 130 * Return a not existing [File] if no such child exist.
120 */ 131 */
121 Resource getChild(String relPath); 132 Resource getChild(String relPath);
122 133
123 /** 134 /**
124 * Return a [File] representing a child [Resource] with the given 135 * Return a [File] representing a child [Resource] with the given
125 * [relPath]. This call does not check whether a file with the given name 136 * [relPath]. This call does not check whether a file with the given name
126 * exists on the filesystem - client must call the [File]'s `exists` getter 137 * exists on the filesystem - client must call the [File]'s `exists` getter
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 */ 174 */
164 String get path; 175 String get path;
165 176
166 /** 177 /**
167 * Return a short version of the name that can be displayed to the user to 178 * Return a short version of the name that can be displayed to the user to
168 * denote this resource. 179 * denote this resource.
169 */ 180 */
170 String get shortName; 181 String get shortName;
171 182
172 /** 183 /**
184 * Copy this resource to a child of the [parentFolder] with the same kind and
185 * [shortName] as this resource. If this resource is a folder, then all of the
186 * contents of the folder will be recursively copied.
187 *
188 * The parent folder is created if it does not already exist.
189 *
190 * Existing files and folders will be overwritten.
191 *
192 * Return the resource corresponding to this resource in the parent folder.
193 */
194 Resource copyTo(Folder parentFolder);
195
196 /**
173 * Synchronously deletes this resource and its children. 197 * Synchronously deletes this resource and its children.
174 * 198 *
175 * Throws an exception if the resource cannot be deleted. 199 * Throws an exception if the resource cannot be deleted.
176 */ 200 */
177 void delete(); 201 void delete();
178 202
179 /** 203 /**
180 * Return `true` if absolute [path] references this resource or a resource in 204 * Return `true` if absolute [path] references this resource or a resource in
181 * this folder. 205 * this folder.
182 */ 206 */
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 300
277 @override 301 @override
278 Uri restoreAbsolute(Source source) => 302 Uri restoreAbsolute(Source source) =>
279 _provider.pathContext.toUri(source.fullName); 303 _provider.pathContext.toUri(source.fullName);
280 304
281 /** 305 /**
282 * Return `true` if the given [uri] is a `file` URI. 306 * Return `true` if the given [uri] is a `file` URI.
283 */ 307 */
284 static bool isFileUri(Uri uri) => uri.scheme == FILE_SCHEME; 308 static bool isFileUri(Uri uri) => uri.scheme == FILE_SCHEME;
285 } 309 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/file_system/memory_file_system.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698