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

Side by Side Diff: sdk/lib/io/file_system_entity.dart

Issue 18042002: dart:io | Add rename() and renameSync() to FileSystem Entity (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 * [Directory], and [Link]. Calling [existsSync] on an instance of 264 * [Directory], and [Link]. Calling [existsSync] on an instance of
265 * one of these subclasses checks whether the object exists in the 265 * one of these subclasses checks whether the object exists in the
266 * file system object exists and is of the correct type (file, 266 * file system object exists and is of the correct type (file,
267 * directory, or link). To check whether a path points to an object 267 * directory, or link). To check whether a path points to an object
268 * on the file system, regardless of the object's type, use the 268 * on the file system, regardless of the object's type, use the
269 * [typeSync] static method. 269 * [typeSync] static method.
270 */ 270 */
271 bool existsSync(); 271 bool existsSync();
272 272
273 /** 273 /**
274 * Renames this file system entity. Returns a `Future<FileSystemEntity>`
275 * that completes with a [FileSystemEntity] instance for the renamed
276 * file system entity.
277 *
278 * If [newPath] identifies an existing entity of the same type, that entity
279 * is replaced. If [newPath] identifies an existing entity of a different
280 * type, the operation fails and the future completes with an exception.
281 */
282 Future<FileSystemEntity> rename(String newPath);
283
284 /**
285 * Synchronously renames this file system entity. Returns a [FileSystemEntity]
286 * instance for the renamed entity.
287 *
288 * If [newPath] identifies an existing entity of the same type, that entity
289 * is replaced. If [newPath] identifies an existing entity of a different
290 * type, the operation fails and an exception is thrown.
291 */
292 FileSystemEntity renameSync(String newPath);
293
294 /**
274 * Calls the operating system's stat() function on the [path] of this 295 * Calls the operating system's stat() function on the [path] of this
275 * [FileSystemEntity]. Identical to [:FileStat.stat(this.path):]. 296 * [FileSystemEntity]. Identical to [:FileStat.stat(this.path):].
276 * 297 *
277 * Returns a [:Future<FileStat>:] object containing the data returned by 298 * Returns a [:Future<FileStat>:] object containing the data returned by
278 * stat(). 299 * stat().
279 * 300 *
280 * If the call fails, completes the future with a [FileStat] object 301 * If the call fails, completes the future with a [FileStat] object
281 * with .type set to 302 * with .type set to
282 * FileSystemEntityType.NOT_FOUND and the other fields invalid. 303 * FileSystemEntityType.NOT_FOUND and the other fields invalid.
283 */ 304 */
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 391
371 392
372 static _throwIfError(Object result, String msg) { 393 static _throwIfError(Object result, String msg) {
373 if (result is OSError) { 394 if (result is OSError) {
374 throw new FileException(msg, result); 395 throw new FileException(msg, result);
375 } else if (result is ArgumentError) { 396 } else if (result is ArgumentError) {
376 throw result; 397 throw result;
377 } 398 }
378 } 399 }
379 } 400 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698