Mandoline filesystem: Build the filesystem on windows.
[chromium-blink-merge.git] / components / filesystem / public / interfaces / directory.mojom
blob5d3a1db4a1c89d311808621b45fb8678f75eec1d
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 module filesystem;
7 import "components/filesystem/public/interfaces/file.mojom";
8 import "components/filesystem/public/interfaces/types.mojom";
10 // This interface provides access to a directory in a "file system", providing
11 // operations such as creating/opening/removing/renaming files/directories
12 // within it. Note that all relative |path| arguments are relative to "this"
13 // directory (i.e., "this" directory functions as the current working directory
14 // for the various operations).
15 // TODO(vtl): Paths may be relative; should they allowed to be absolute?
16 // (Currently not.)
17 interface Directory {
18   // Operations about "this" |Directory|:
20   // Reads the contents of this directory.
21   // TODO(vtl): Clarify error codes versus |directory_contents|.
22   Read() => (FileError error, array<DirectoryEntry>? directory_contents);
24   // Operations *in* "this" |Directory|:
26   // Opens the file specified by |path| with the given |open_flags|. |file| is
27   // optional, mainly for consistency with |OpenDirectory()| (but may be useful,
28   // together with |kOpenFlagCreate|, for "touching" a file).
29   OpenFile(string path, File&? file, uint32 open_flags)
30       => (FileError error);
32   // Opens the directory specified by |path|. |directory| is optional, so that
33   // this may be used as a simple "mkdir()" with |kOpenFlagCreate|.
34   OpenDirectory(string path,
35                 Directory&? directory,
36                 uint32 open_flags) => (FileError error);
38   // Renames/moves the file/directory given by |path| to |new_path|.
39   Rename(string path, string new_path) => (FileError error);
41   // Deletes the given path, which may be a file or a directory (see
42   // |kDeleteFlag...| for details).
43   Delete(string path, uint32 delete_flags) => (FileError error);
45   // TODO(vtl): directory "streaming"?
46   // TODO(vtl): "make root" (i.e., prevent cd-ing, etc., to parent); note that
47   // this would require a much more complicated implementation (e.g., it needs
48   // to be "inherited" by OpenDirectory(), and the enforcement needs to be valid
49   // even if the opened directory is subsequently moved -- e.g., closer to the
50   // "root")
51   // TODO(vtl): Add a "watch"?