Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 module mojo.files; | |
| 6 | |
| 7 import "services/files/file.mojom"; | |
| 8 import "services/files/types.mojom"; | |
| 9 | |
| 10 // TODO(vtl): paths may be relative; should they allowed to be absolute? | |
| 11 // (currently not) | |
| 12 | |
| 13 // TODO(vtl): Write comments. | |
| 14 interface Directory { | |
| 15 // Operations about "this" |Directory|: | |
| 16 | |
| 17 // TODO(vtl): Should we have a "close" method? | |
|
qsr
2015/03/02 12:46:40
Isn't closing the handle enough? What can you do w
viettrungluu
2015/03/02 18:10:59
See my answer for files. Having an explicit close
| |
| 18 Read() => (Error error, array<DirectoryEntry>? directory_contents); | |
| 19 Stat() => (Error error, FileInformation? file_information); | |
| 20 Touch(TimespecOrNow? atime, TimespecOrNow? mtime) => (Error error); | |
|
qsr
2015/03/02 12:46:40
Do a null atime or mtime means I should not modify
viettrungluu
2015/03/02 18:10:59
See TODO at line #13. Lots of comments are obvious
| |
| 21 | |
| 22 // Operations *in* "this" |Directory|: | |
| 23 | |
| 24 // Note: |file| is optional, for consistency with |OpenDirectory()|. However, | |
| 25 // it's somewhat useful with |kOpenFlagCreate| to "touch" a file. | |
| 26 OpenFile(string path, File&? file, uint32 open_flags) | |
| 27 => (Error error); | |
| 28 // Note: This can be used as a simple "mkdir()" with |kOpenFlagCreate| and no | |
| 29 // |directory|. | |
| 30 OpenDirectory(string path, | |
| 31 Directory&? directory, | |
| 32 uint32 open_flags) => (Error error); | |
| 33 | |
| 34 Rename(string path, string new_path) => (Error error); | |
| 35 | |
| 36 // Deletes the given path, which may be a file or a directory (see | |
| 37 // |kDeleteFlag...| for details). | |
| 38 Delete(string path, uint32 delete_flags) => (Error error); | |
| 39 | |
| 40 // TODO(vtl): directory "streaming"? | |
| 41 // TODO(vtl): "make root" (i.e., prevent cd-ing, etc., to parent); note that | |
| 42 // this would require a much more complicated implementation (e.g., it needs | |
| 43 // to be "inherited" by OpenDirectory(), and the enforcement needs to be valid | |
| 44 // even if the opened directory is subsequently moved -- e.g., closer to the | |
| 45 // "root") | |
| 46 // TODO(vtl): Add a "watch"? | |
| 47 }; | |
| OLD | NEW |