OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 [DartPackage="mojo_services"] | 5 [DartPackage="mojo_services"] |
6 module mojo.files; | 6 module mojo.files; |
7 | 7 |
8 import "files/interfaces/file.mojom"; | 8 import "files/interfaces/file.mojom"; |
9 import "files/interfaces/types.mojom"; | 9 import "files/interfaces/types.mojom"; |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 // Updates this directory's atime and/or mtime to the time specified by | 29 // Updates this directory's atime and/or mtime to the time specified by |
30 // |atime| (or |mtime|, respectively), which may also indicate "now". If | 30 // |atime| (or |mtime|, respectively), which may also indicate "now". If |
31 // |atime| or |mtime| is null, then the corresponding time is not modified. | 31 // |atime| or |mtime| is null, then the corresponding time is not modified. |
32 Touch(TimespecOrNow? atime, TimespecOrNow? mtime) => (Error error); | 32 Touch(TimespecOrNow? atime, TimespecOrNow? mtime) => (Error error); |
33 | 33 |
34 // Operations *in* "this" |Directory|: | 34 // Operations *in* "this" |Directory|: |
35 | 35 |
36 // Opens the file specified by |path| with the given |open_flags|. |file| is | 36 // Opens the file specified by |path| with the given |open_flags|. |file| is |
37 // optional, mainly for consistency with |OpenDirectory()| (but may be useful, | 37 // optional, mainly for consistency with |OpenDirectory()| (but may be useful, |
38 // together with |kOpenFlagCreate|, for "touching" a file). | 38 // together with |kOpenFlagCreate|, for "touching" a file). |
39 OpenFile(string path, File&? file, uint32 open_flags) | 39 OpenFile(string path, File&? file, uint32 open_flags) => (Error error); |
40 => (Error error); | |
41 | 40 |
42 // Opens the directory specified by |path|. |directory| is optional, so that | 41 // Opens the directory specified by |path|. |directory| is optional, so that |
43 // this may be used as a simple "mkdir()" with |kOpenFlagCreate|. | 42 // this may be used as a simple "mkdir()" with |kOpenFlagCreate|. |
44 OpenDirectory(string path, | 43 OpenDirectory(string path, Directory&? directory, uint32 open_flags) |
45 Directory&? directory, | 44 => (Error error); |
46 uint32 open_flags) => (Error error); | |
47 | 45 |
48 // Renames/moves the file/directory given by |path| to |new_path|. | 46 // Renames/moves the file/directory given by |path| to |new_path|. |
49 Rename(string path, string new_path) => (Error error); | 47 Rename(string path, string new_path) => (Error error); |
50 | 48 |
51 // Deletes the given path, which may be a file or a directory (see | 49 // Deletes the given path, which may be a file or a directory (see |
52 // |kDeleteFlag...| for details). | 50 // |kDeleteFlag...| for details). |
53 Delete(string path, uint32 delete_flags) => (Error error); | 51 Delete(string path, uint32 delete_flags) => (Error error); |
54 | 52 |
55 // TODO(vtl): directory "streaming"? | 53 // TODO(vtl): directory "streaming"? |
56 // TODO(vtl): "make root" (i.e., prevent cd-ing, etc., to parent); note that | 54 // TODO(vtl): "make root" (i.e., prevent cd-ing, etc., to parent); note that |
57 // this would require a much more complicated implementation (e.g., it needs | 55 // this would require a much more complicated implementation (e.g., it needs |
58 // to be "inherited" by OpenDirectory(), and the enforcement needs to be valid | 56 // to be "inherited" by OpenDirectory(), and the enforcement needs to be valid |
59 // even if the opened directory is subsequently moved -- e.g., closer to the | 57 // even if the opened directory is subsequently moved -- e.g., closer to the |
60 // "root") | 58 // "root") |
61 // TODO(vtl): Add a "watch"? | 59 // TODO(vtl): Add a "watch"? |
62 // TODO(vtl): Should we have a "close" method? | 60 // TODO(vtl): Should we have a "close" method? |
63 // TODO(vtl): Add Dup() and Reopen() (like File)? | 61 // TODO(vtl): Add Dup() and Reopen() (like File)? |
64 }; | 62 }; |
OLD | NEW |