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 RUNTIME_BIN_DIRECTORY_H_ | 5 #ifndef RUNTIME_BIN_DIRECTORY_H_ |
6 #define RUNTIME_BIN_DIRECTORY_H_ | 6 #define RUNTIME_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 "bin/reference_counting.h" | 10 #include "bin/reference_counting.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 bool error() const { return error_; } | 137 bool error() const { return error_; } |
138 | 138 |
139 private: | 139 private: |
140 PathBuffer path_buffer_; | 140 PathBuffer path_buffer_; |
141 DirectoryListingEntry* top_; | 141 DirectoryListingEntry* top_; |
142 bool error_; | 142 bool error_; |
143 bool recursive_; | 143 bool recursive_; |
144 bool follow_links_; | 144 bool follow_links_; |
145 }; | 145 }; |
146 | 146 |
147 | |
148 class AsyncDirectoryListing : public ReferenceCounted<AsyncDirectoryListing>, | 147 class AsyncDirectoryListing : public ReferenceCounted<AsyncDirectoryListing>, |
149 public DirectoryListing { | 148 public DirectoryListing { |
150 public: | 149 public: |
151 enum Response { | 150 enum Response { |
152 kListFile = 0, | 151 kListFile = 0, |
153 kListDirectory = 1, | 152 kListDirectory = 1, |
154 kListLink = 2, | 153 kListLink = 2, |
155 kListError = 3, | 154 kListError = 3, |
156 kListDone = 4 | 155 kListDone = 4 |
157 }; | 156 }; |
(...skipping 24 matching lines...) Expand all Loading... |
182 virtual ~AsyncDirectoryListing() {} | 181 virtual ~AsyncDirectoryListing() {} |
183 bool AddFileSystemEntityToResponse(Response response, const char* arg); | 182 bool AddFileSystemEntityToResponse(Response response, const char* arg); |
184 CObjectArray* array_; | 183 CObjectArray* array_; |
185 intptr_t index_; | 184 intptr_t index_; |
186 intptr_t length_; | 185 intptr_t length_; |
187 | 186 |
188 friend class ReferenceCounted<AsyncDirectoryListing>; | 187 friend class ReferenceCounted<AsyncDirectoryListing>; |
189 DISALLOW_IMPLICIT_CONSTRUCTORS(AsyncDirectoryListing); | 188 DISALLOW_IMPLICIT_CONSTRUCTORS(AsyncDirectoryListing); |
190 }; | 189 }; |
191 | 190 |
192 | |
193 class SyncDirectoryListing : public DirectoryListing { | 191 class SyncDirectoryListing : public DirectoryListing { |
194 public: | 192 public: |
195 SyncDirectoryListing(Dart_Handle results, | 193 SyncDirectoryListing(Dart_Handle results, |
196 const char* dir_name, | 194 const char* dir_name, |
197 bool recursive, | 195 bool recursive, |
198 bool follow_links) | 196 bool follow_links) |
199 : DirectoryListing(dir_name, recursive, follow_links), | 197 : DirectoryListing(dir_name, recursive, follow_links), |
200 results_(results), | 198 results_(results), |
201 dart_error_(Dart_Null()) { | 199 dart_error_(Dart_Null()) { |
202 add_string_ = DartUtils::NewString("add"); | 200 add_string_ = DartUtils::NewString("add"); |
(...skipping 14 matching lines...) Expand all Loading... |
217 Dart_Handle add_string_; | 215 Dart_Handle add_string_; |
218 Dart_Handle directory_type_; | 216 Dart_Handle directory_type_; |
219 Dart_Handle file_type_; | 217 Dart_Handle file_type_; |
220 Dart_Handle link_type_; | 218 Dart_Handle link_type_; |
221 Dart_Handle dart_error_; | 219 Dart_Handle dart_error_; |
222 | 220 |
223 DISALLOW_ALLOCATION() | 221 DISALLOW_ALLOCATION() |
224 DISALLOW_IMPLICIT_CONSTRUCTORS(SyncDirectoryListing); | 222 DISALLOW_IMPLICIT_CONSTRUCTORS(SyncDirectoryListing); |
225 }; | 223 }; |
226 | 224 |
227 | |
228 class Directory { | 225 class Directory { |
229 public: | 226 public: |
230 enum ExistsResult { UNKNOWN, EXISTS, DOES_NOT_EXIST }; | 227 enum ExistsResult { UNKNOWN, EXISTS, DOES_NOT_EXIST }; |
231 | 228 |
232 static void List(DirectoryListing* listing); | 229 static void List(DirectoryListing* listing); |
233 static ExistsResult Exists(const char* path); | 230 static ExistsResult Exists(const char* path); |
234 | 231 |
235 // Returns the current working directory. The caller must call | 232 // Returns the current working directory. The caller must call |
236 // free() on the result. | 233 // free() on the result. |
237 static char* CurrentNoScope(); | 234 static char* CurrentNoScope(); |
(...skipping 23 matching lines...) Expand all Loading... |
261 private: | 258 private: |
262 static char* system_temp_path_override_; | 259 static char* system_temp_path_override_; |
263 DISALLOW_ALLOCATION(); | 260 DISALLOW_ALLOCATION(); |
264 DISALLOW_IMPLICIT_CONSTRUCTORS(Directory); | 261 DISALLOW_IMPLICIT_CONSTRUCTORS(Directory); |
265 }; | 262 }; |
266 | 263 |
267 } // namespace bin | 264 } // namespace bin |
268 } // namespace dart | 265 } // namespace dart |
269 | 266 |
270 #endif // RUNTIME_BIN_DIRECTORY_H_ | 267 #endif // RUNTIME_BIN_DIRECTORY_H_ |
OLD | NEW |