Skip to content

Commit cadf424

Browse files
authored
Merge branch 'whatwg:main' into remove
2 parents 348a9dc + 99b46e2 commit cadf424

File tree

2 files changed

+999
-10
lines changed

2 files changed

+999
-10
lines changed

index.bs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Group: WHATWG
33
H1: File System
44
Shortname: fs
55
Text Macro: TWITTER whatfilesystem
6+
Text Macro: LATESTRD 2022-03
67
Abstract: File System defines infrastructure for file systems as well as their API.
78
Indent: 2
89
Markup Shorthands: css no, markdown yes
@@ -673,9 +674,6 @@ these steps:
673674
and |child| represents `/home/user/project/foo/bar`, this will return
674675
`['foo', 'bar']`.
675676
:: Otherwise (|directory| and |child| are not related), |path| will be null.
676-
677-
This functionality can be useful if a web application shows a directory
678-
listing to highlight a file opened through a file picker in that directory listing.
679677
</div>
680678

681679
<div class=example id=filesystemdirectoryhandle-resolve-example>
@@ -684,17 +682,13 @@ these steps:
684682
const dir_ref = current_project_dir;
685683
if (!dir_ref) return;
686684

687-
// Now get a file reference by showing a file picker:
688-
const file_ref = await self.showOpenFilePicker();
689-
if (!file_ref) {
690-
// User cancelled, or otherwise failed to open a file.
691-
return;
692-
}
685+
// Now get a file reference:
686+
const file_ref = await dir_ref.getFileHandle(filename, { create: true });
693687

694688
// Check if file_ref exists inside dir_ref:
695689
const relative_path = await dir_ref.resolve(file_ref);
696690
if (relative_path === null) {
697-
// Not inside dir_ref
691+
// Not inside dir_ref.
698692
} else {
699693
// relative_path is an array of names, giving the relative path
700694
// from dir_ref to the file that is represented by file_ref:

0 commit comments

Comments
 (0)