Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove copy and move methods. #50

Merged
merged 1 commit into from
May 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions EXPLAINER.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,12 @@ const file_ref = await dir_ref.getFile('foo.js');
// Get a subdirectory.
const subdir = await dir_ref.getDirectory('bla', {createIfNotExists: true});

// And you can possibly do stuff like move and/or copy files around.
await file_ref.copyTo(dir_ref, 'new_name', {overwrite: true});
// No special API to create copies, but still possible to do so by using
// available read and write APIs.
const new_file = await dir_ref.getFile('new_name', {create: true});
const new_file_writer = await new_file.createWriter();
await new_file_writer.truncate(0);
await new_file_writer.write(0, await file_ref.getFile());
```

You can also check if two references reference the same file or directory (or at
Expand Down
58 changes: 0 additions & 58 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ interface FileSystemHandle {
readonly attribute boolean isDirectory;
readonly attribute USVString name;

Promise<FileSystemHandle> moveTo(USVString name);
Promise<FileSystemHandle> moveTo(
FileSystemDirectoryHandle parent, optional USVString name);
Promise<FileSystemHandle> copyTo(
FileSystemDirectoryHandle parent, optional USVString name);
Promise<void> remove();

Promise<PermissionState> queryPermission(optional FileSystemHandlePermissionDescriptor descriptor);
Expand Down Expand Up @@ -110,59 +105,6 @@ associated [=FileSystemHandle/entry=] is a [=directory entry=], and false otherw
The <dfn attribute for=FileSystemHandle>name</dfn> attribute must return the [=entry/name=] of the
associated [=FileSystemHandle/entry=].

### The {{FileSystemHandle/moveTo()}} method ### {#api-filesystemhandle-moveto}

<div class="note domintro">
: |newHandle| = await |handle| . {{FileSystemHandle/moveTo()|moveTo}}(|newName|)
:: Renames the entry represented by |handle| to |newName|.

: |newHandle| = await |handle| . {{FileSystemHandle/moveTo()|moveTo}}(|otherDir|)
:: Moves the entry represented by |handle| to |otherDir|, while keeping its existing name.

: |newHandle| = await |handle| . {{FileSystemHandle/moveTo()|moveTo}}(|otherDir|, |newName|)
:: Moves the entry represented by |handle| to |otherDir|, while renaming it to |newName|.

In all of these cases, |handle| will no longer represent a valid entry, and thus any further
operations on it will fail.

Attempting to move an entry to the directory it already exists in, without renaming it is
an error. In all other cases if the target entry already exists, it is overwritten.
</div>

<div algorithm>
The <dfn method for=FileSystemHandle>moveTo(|parent|, |name|)</dfn> method, when invoked, must run
these steps:

1. TODO

</div>

### The {{FileSystemHandle/copyTo()}} method ### {#api-filesystemhandle-copyto}

<div class="note domintro">
: |newHandle| = await |handle| . {{FileSystemHandle/copyTo()|copyTo}}(|otherDir|)
:: Creates a copy of the entry represented by |handle| in |otherDir|, while keeping its existing
name.

: |newHandle| = await |handle| . {{FileSystemHandle/copyTo()|copyTo}}(|otherDir|, |newName|)
:: Creates a copy of the entry represented by |handle| in |otherDir|, using |newName| for the
name of the new entry.

In all of these cases, |handle| will no longer represent a valid entry, and thus any further
operations on it will fail.

Attempting to copy an entry on top of itself will fail. In all other cases if the target entry
already exists, it is overwritten.
</div>

<div algorithm>
The <dfn method for=FileSystemHandle>copyTo(|parent|, |name|)</dfn> method, when invoked, must run
these steps:

1. TODO

</div>

### The {{FileSystemHandle/remove()}} method ### {#api-filesystemhandle-remove}

<div class="note domintro">
Expand Down