| 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 /** | 7 /** |
| 8 * FileMode describes the modes in which a file can be opened. | 8 * FileMode describes the modes in which a file can be opened. |
| 9 */ | 9 */ |
| 10 class FileMode { | 10 class FileMode { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 abstract class File implements FileSystemEntity { | 37 abstract class File implements FileSystemEntity { |
| 38 /** | 38 /** |
| 39 * Create a File object. | 39 * Create a File object. |
| 40 */ | 40 */ |
| 41 factory File(String path) => new _File(path); | 41 factory File(String path) => new _File(path); |
| 42 | 42 |
| 43 /** | 43 /** |
| 44 * Create the file. Returns a [:Future<File>:] that completes with | 44 * Create the file. Returns a [:Future<File>:] that completes with |
| 45 * the file when it has been created. | 45 * the file when it has been created. |
| 46 * | 46 * |
| 47 * If [recursive] is false, the default, the file is created only if |
| 48 * all directories in the path exist. If [recursive] is true, all |
| 49 * non-existing path components are created. |
| 50 * |
| 47 * Existing files are left untouched by [create]. Calling [create] on an | 51 * Existing files are left untouched by [create]. Calling [create] on an |
| 48 * existing file might fail if there are restrictive permissions on | 52 * existing file might fail if there are restrictive permissions on |
| 49 * the file. | 53 * the file. |
| 54 * |
| 55 * Completes the future with a [FileSystemException] if the operation fails. |
| 50 */ | 56 */ |
| 51 Future<File> create(); | 57 Future<File> create({bool recursive: false}); |
| 52 | 58 |
| 53 /** | 59 /** |
| 54 * Synchronously create the file. Existing files are left untouched | 60 * Synchronously create the file. Existing files are left untouched |
| 55 * by [createSync]. Calling [createSync] on an existing file might fail | 61 * by [createSync]. Calling [createSync] on an existing file might fail |
| 56 * if there are restrictive permissions on the file. | 62 * if there are restrictive permissions on the file. |
| 57 * | 63 * |
| 64 * If [recursive] is false, the default, the file is created |
| 65 * only if all directories in the path exist. |
| 66 * If [recursive] is true, all non-existing path components are created. |
| 67 * |
| 58 * Throws a [FileSystemException] if the operation fails. | 68 * Throws a [FileSystemException] if the operation fails. |
| 59 */ | 69 */ |
| 60 void createSync(); | 70 void createSync({bool recursive: false}); |
| 61 | 71 |
| 62 /** | 72 /** |
| 63 * Renames this file. Returns a `Future<File>` that completes | 73 * Renames this file. Returns a `Future<File>` that completes |
| 64 * with a [File] instance for the renamed file. | 74 * with a [File] instance for the renamed file. |
| 65 * | 75 * |
| 66 * If [newPath] identifies an existing file, that file is | 76 * If [newPath] identifies an existing file, that file is |
| 67 * replaced. If [newPath] identifies an existing directory, the | 77 * replaced. If [newPath] identifies an existing directory, the |
| 68 * operation fails and the future completes with an exception. | 78 * operation fails and the future completes with an exception. |
| 69 */ | 79 */ |
| 70 Future<File> rename(String newPath); | 80 Future<File> rename(String newPath); |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 } | 525 } |
| 516 } else if (osError != null) { | 526 } else if (osError != null) { |
| 517 sb.write(": osError"); | 527 sb.write(": osError"); |
| 518 if (path != null) { | 528 if (path != null) { |
| 519 sb.write(", path = $path"); | 529 sb.write(", path = $path"); |
| 520 } | 530 } |
| 521 } | 531 } |
| 522 return sb.toString(); | 532 return sb.toString(); |
| 523 } | 533 } |
| 524 } | 534 } |
| OLD | NEW |