OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef BIN_DIRECTORY_H_ | 5 #ifndef BIN_DIRECTORY_H_ |
6 #define BIN_DIRECTORY_H_ | 6 #define BIN_DIRECTORY_H_ |
7 | 7 |
8 #include "bin/builtin.h" | 8 #include "bin/builtin.h" |
9 #include "bin/dartutils.h" | 9 #include "bin/dartutils.h" |
10 #include "platform/globals.h" | 10 #include "platform/globals.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 | 35 |
36 class Directory { | 36 class Directory { |
37 public: | 37 public: |
38 enum ExistsResult { | 38 enum ExistsResult { |
39 UNKNOWN, | 39 UNKNOWN, |
40 EXISTS, | 40 EXISTS, |
41 DOES_NOT_EXIST | 41 DOES_NOT_EXIST |
42 }; | 42 }; |
43 | 43 |
| 44 // This enum must be kept in sync with the request values in |
| 45 // directory_impl.dart. |
44 enum DirectoryRequest { | 46 enum DirectoryRequest { |
45 kCreateRequest = 0, | 47 kCreateRequest = 0, |
46 kDeleteRequest = 1, | 48 kDeleteRequest = 1, |
47 kExistsRequest = 2, | 49 kExistsRequest = 2, |
48 kCreateTempRequest = 3, | 50 kCreateTempRequest = 3, |
49 kListRequest = 4 | 51 kListRequest = 4, |
| 52 kRenameRequest = 5 |
50 }; | 53 }; |
51 | 54 |
52 static bool List(const char* path, | 55 static bool List(const char* path, |
53 bool recursive, | 56 bool recursive, |
54 DirectoryListing* listing); | 57 DirectoryListing* listing); |
55 | |
56 static ExistsResult Exists(const char* path); | 58 static ExistsResult Exists(const char* path); |
57 | |
58 static char* Current(); | 59 static char* Current(); |
59 | |
60 static bool Create(const char* path); | 60 static bool Create(const char* path); |
61 | |
62 static char* CreateTemp(const char* const_template); | 61 static char* CreateTemp(const char* const_template); |
63 | |
64 static bool Delete(const char* path, bool recursive); | 62 static bool Delete(const char* path, bool recursive); |
65 | 63 static bool Rename(const char* path, const char* new_path); |
66 static Dart_Port GetServicePort(); | 64 static Dart_Port GetServicePort(); |
67 | 65 |
68 private: | 66 private: |
69 static dart::Mutex mutex_; | 67 static dart::Mutex mutex_; |
70 static int service_ports_size_; | 68 static int service_ports_size_; |
71 static Dart_Port* service_ports_; | 69 static Dart_Port* service_ports_; |
72 static int service_ports_index_; | 70 static int service_ports_index_; |
73 | 71 |
74 DISALLOW_ALLOCATION(); | 72 DISALLOW_ALLOCATION(); |
75 DISALLOW_IMPLICIT_CONSTRUCTORS(Directory); | 73 DISALLOW_IMPLICIT_CONSTRUCTORS(Directory); |
76 }; | 74 }; |
77 | 75 |
78 | 76 |
79 #endif // BIN_DIRECTORY_H_ | 77 #endif // BIN_DIRECTORY_H_ |
OLD | NEW |