| Index: sdk/lib/io/link.dart
|
| diff --git a/sdk/lib/io/link.dart b/sdk/lib/io/link.dart
|
| index 8c28eb4e9ef2bcb4f5661145a62a6d6a17f21322..8b726ed5ba34136edd7eaf95368c5f2d7eecf0d0 100644
|
| --- a/sdk/lib/io/link.dart
|
| +++ b/sdk/lib/io/link.dart
|
| @@ -55,14 +55,20 @@ abstract class Link implements FileSystemEntity {
|
| * Synchronously updates the link. Calling [updateSync] on a non-existing link
|
| * will throw an exception.
|
| *
|
| - * If [linkRelative] is true, the target argument should be a relative path,
|
| - * and the link will interpret the target as a path relative to the link's
|
| - * directory.
|
| + * On the Windows platform, this will only work with directories, and the
|
| + * target directory must exist.
|
| + */
|
| + void updateSync(String target);
|
| +
|
| + /**
|
| + * Updates the link. Returns a [:Future<Link>:] that completes with the
|
| + * link when it has been updated. Calling [update] on a non-existing link
|
| + * will complete its returned future with an exception.
|
| *
|
| * On the Windows platform, this will only work with directories, and the
|
| * target directory must exist.
|
| */
|
| - void updateSync(String target, {bool linkRelative: false });
|
| + Future<Link> update(String target);
|
|
|
| /**
|
| * Deletes the link. Returns a [:Future<Link>:] that completes with
|
| @@ -198,12 +204,23 @@ class _Link extends FileSystemEntity implements Link {
|
| return target;
|
| }
|
|
|
| - void updateSync(String target, {bool linkRelative: false }) {
|
| - // TODO(whesse): Replace with atomic update, where supported by platform.
|
| + void updateSync(String target) {
|
| + // TODO(12414): Replace with atomic update, where supported by platform.
|
| + // Atomically changing a link can be done by creating the new link, with
|
| + // a different name, and using the rename() posix call to move it to
|
| + // the old name atomically.
|
| deleteSync();
|
| createSync(target);
|
| }
|
|
|
| + Future<Link> update(String target) {
|
| + // TODO(12414): Replace with atomic update, where supported by platform.
|
| + // Atomically changing a link can be done by creating the new link, with
|
| + // a different name, and using the rename() posix call to move it to
|
| + // the old name atomically.
|
| + return delete().then((_) => create(target));
|
| + }
|
| +
|
| Future<Link> delete() {
|
| _ensureFileService();
|
| List request = new List(2);
|
|
|