Skip to content

Commit 99b46e2

Browse files
authored
Remove use of showOpenFilePicker() in example
Closes #22.
1 parent 464b505 commit 99b46e2

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

index.bs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -604,9 +604,6 @@ these steps:
604604
and |child| represents `/home/user/project/foo/bar`, this will return
605605
`['foo', 'bar']`.
606606
:: Otherwise (|directory| and |child| are not related), |path| will be null.
607-
608-
This functionality can be useful if a web application shows a directory
609-
listing to highlight a file opened through a file picker in that directory listing.
610607
</div>
611608

612609
<div class=example id=filesystemdirectoryhandle-resolve-example>
@@ -615,17 +612,13 @@ these steps:
615612
const dir_ref = current_project_dir;
616613
if (!dir_ref) return;
617614

618-
// Now get a file reference by showing a file picker:
619-
const file_ref = await self.showOpenFilePicker();
620-
if (!file_ref) {
621-
// User cancelled, or otherwise failed to open a file.
622-
return;
623-
}
615+
// Now get a file reference:
616+
const file_ref = await dir_ref.getFileHandle(filename, { create: true });
624617

625618
// Check if file_ref exists inside dir_ref:
626619
const relative_path = await dir_ref.resolve(file_ref);
627620
if (relative_path === null) {
628-
// Not inside dir_ref
621+
// Not inside dir_ref.
629622
} else {
630623
// relative_path is an array of names, giving the relative path
631624
// from dir_ref to the file that is represented by file_ref:

0 commit comments

Comments
 (0)