OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of dart.io; | 5 part of dart.io; |
6 | 6 |
7 class FileSystemEntityType { | 7 class FileSystemEntityType { |
8 static const FILE = const FileSystemEntityType._internal(0); | 8 static const FILE = const FileSystemEntityType._internal(0); |
9 static const DIRECTORY = const FileSystemEntityType._internal(1); | 9 static const DIRECTORY = const FileSystemEntityType._internal(1); |
10 static const LINK = const FileSystemEntityType._internal(2); | 10 static const LINK = const FileSystemEntityType._internal(2); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 * Synchronously renames this file system entity. Returns a [FileSystemEntity] | 214 * Synchronously renames this file system entity. Returns a [FileSystemEntity] |
215 * instance for the renamed entity. | 215 * instance for the renamed entity. |
216 * | 216 * |
217 * If [newPath] identifies an existing entity of the same type, that entity | 217 * If [newPath] identifies an existing entity of the same type, that entity |
218 * is replaced. If [newPath] identifies an existing entity of a different | 218 * is replaced. If [newPath] identifies an existing entity of a different |
219 * type, the operation fails and an exception is thrown. | 219 * type, the operation fails and an exception is thrown. |
220 */ | 220 */ |
221 FileSystemEntity renameSync(String newPath); | 221 FileSystemEntity renameSync(String newPath); |
222 | 222 |
223 /** | 223 /** |
224 * Resolves the path of a file system object relative to the | |
225 * current working directory, resolving all symbolic links on | |
226 * the path and resolving all '..' and '.' path segments. | |
227 * [resolveSymbolicLinks] returns a [:Future<String>:] | |
228 * | |
229 * [resolveSymbolicLinks] uses the operating system's native filesystem api | |
230 * to resolve the path, using the realpath function on linux and | |
231 * Mac OS, and the GetFinalPathNameByHandle function on Windows. | |
232 * If the path does not point to an existing file system object, | |
233 * [resolveSymbolicLinks] completes the returned Future with an exception. | |
234 * The type of the exception is determined by the type of [this], | |
235 * so a File object gives a FileException, etc. | |
236 * | |
237 * On Windows, symbolic links are resolved to their target before applying | |
238 * a '..' that follows, and on other platforms, the '..' is applied to the | |
239 * symbolic link without resolving it. The second behavior can be emulated | |
240 * on Windows by processing any '..' segments before calling | |
241 * [resolveSymbolicLinks]. One way of doing this is with the URI class: | |
242 * [:new Uri.parse('.').resolveUri(new Uri.file(input)).toFilePath();], | |
243 * since [resolve] removes '..' segments. | |
244 */ | |
245 Future<String> resolveSymbolicLinks(); | |
Anders Johnsen
2013/09/09 12:24:48
Impl could be here, as it should do the same for F
Bill Hesse
2013/09/13 06:34:13
Done.
| |
246 | |
247 /** | |
248 * Resolves the path of a file system object relative to the | |
249 * current working directory, resolving all symbolic links on | |
250 * the path and resolving all '..' and '.' path segments. | |
251 * | |
252 * [resolveSymbolicLinksSync] uses the operating system's native | |
253 * filesystem api to resolve the path, using the realpath function | |
254 * on linux and Mac OS, and the GetFinalPathNameByHandle function on Windows. | |
255 * If the path does not point to an existing file system object, | |
256 * [resolveSymbolicLinksSync] throws an exception. | |
257 * The type of the exception is determined by the type of [this], | |
258 * so a File object gives a FileException, etc. | |
259 * | |
260 * On Windows, symbolic links are resolved to their target before applying | |
261 * a '..' that follows, and on other platforms, the '..' is applied to the | |
262 * symbolic link without resolving it. The second behavior can be emulated | |
263 * on Windows by processing any '..' segments before calling | |
264 * [resolveSymbolicLinks]. One way of doing this is with the URI class: | |
265 * [:new Uri.parse('.').resolveUri(new Uri.file(input)).toFilePath();], | |
266 * since [resolve] removes '..' segments. | |
267 */ | |
268 String resolveSymbolicLinksSync(); | |
269 | |
270 /** | |
224 * Calls the operating system's stat() function on the [path] of this | 271 * Calls the operating system's stat() function on the [path] of this |
225 * [FileSystemEntity]. Identical to [:FileStat.stat(this.path):]. | 272 * [FileSystemEntity]. Identical to [:FileStat.stat(this.path):]. |
226 * | 273 * |
227 * Returns a [:Future<FileStat>:] object containing the data returned by | 274 * Returns a [:Future<FileStat>:] object containing the data returned by |
228 * stat(). | 275 * stat(). |
229 * | 276 * |
230 * If the call fails, completes the future with a [FileStat] object | 277 * If the call fails, completes the future with a [FileStat] object |
231 * with .type set to | 278 * with .type set to |
232 * FileSystemEntityType.NOT_FOUND and the other fields invalid. | 279 * FileSystemEntityType.NOT_FOUND and the other fields invalid. |
233 */ | 280 */ |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
309 Stream<FileSystemEvent> watch({int events: FileSystemEvent.ALL, | 356 Stream<FileSystemEvent> watch({int events: FileSystemEvent.ALL, |
310 bool recursive: false}) | 357 bool recursive: false}) |
311 => new _FileSystemWatcher(_trimTrailingPathSeparators(path), | 358 => new _FileSystemWatcher(_trimTrailingPathSeparators(path), |
312 events, | 359 events, |
313 recursive).stream; | 360 recursive).stream; |
314 | 361 |
315 Future<FileSystemEntity> _delete({recursive: false}); | 362 Future<FileSystemEntity> _delete({recursive: false}); |
316 void _deleteSync({recursive: false}); | 363 void _deleteSync({recursive: false}); |
317 | 364 |
318 /** | 365 /** |
319 * Synchronously checks whether two paths refer to the same object in the | 366 * Checks whether two paths refer to the same object in the |
320 * file system. Returns a [:Future<bool>:] that completes with the result. | 367 * file system. Returns a [:Future<bool>:] that completes with the result. |
321 * | 368 * |
322 * Comparing a link to its target returns false, as does comparing two links | 369 * Comparing a link to its target returns false, as does comparing two links |
323 * that point to the same target. To check the target of a link, use | 370 * that point to the same target. To check the target of a link, use |
324 * Link.target explicitly to fetch it. Directory links appearing | 371 * Link.target explicitly to fetch it. Directory links appearing |
325 * inside a path are followed, though, to find the file system object. | 372 * inside a path are followed, though, to find the file system object. |
326 * | 373 * |
327 * Completes the returned Future with an error if one of the paths points | 374 * Completes the returned Future with an error if one of the paths points |
328 * to an object that does not exist. | 375 * to an object that does not exist. |
329 */ | 376 */ |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
580 } | 627 } |
581 } | 628 } |
582 | 629 |
583 | 630 |
584 abstract class _FileSystemWatcher { | 631 abstract class _FileSystemWatcher { |
585 external factory _FileSystemWatcher(String path, int events, bool recursive); | 632 external factory _FileSystemWatcher(String path, int events, bool recursive); |
586 external static bool get isSupported; | 633 external static bool get isSupported; |
587 | 634 |
588 Stream<FileSystemEvent> get stream; | 635 Stream<FileSystemEvent> get stream; |
589 } | 636 } |
OLD | NEW |