OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 #include <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "vm/dev_fs.h" | 9 #include "vm/dev_fs.h" |
10 | 10 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 } | 101 } |
102 | 102 |
103 void ListFiles(JSONStream* js) { | 103 void ListFiles(JSONStream* js) { |
104 JSONObject jsobj(js); | 104 JSONObject jsobj(js); |
105 jsobj.AddProperty("type", "FSFilesList"); | 105 jsobj.AddProperty("type", "FSFilesList"); |
106 JSONArray jsarr(&jsobj, "files"); | 106 JSONArray jsarr(&jsobj, "files"); |
107 std::map<std::string, std::vector<uint8_t>*>::iterator iter; | 107 std::map<std::string, std::vector<uint8_t>*>::iterator iter; |
108 for (iter = files_.begin(); iter != files_.end(); iter++) { | 108 for (iter = files_.begin(); iter != files_.end(); iter++) { |
109 JSONObject file_info(&jsarr); | 109 JSONObject file_info(&jsarr); |
110 file_info.AddProperty("name", iter->first.c_str()); | 110 file_info.AddProperty("name", iter->first.c_str()); |
111 file_info.AddProperty("size", static_cast<int64_t>(iter->second->size())); | 111 file_info.AddProperty64("size", |
| 112 static_cast<int64_t>(iter->second->size())); |
112 } | 113 } |
113 } | 114 } |
114 | 115 |
115 private: | 116 private: |
116 std::string name_; | 117 std::string name_; |
117 | 118 |
118 std::map<std::string, std::vector<uint8_t>*> files_; | 119 std::map<std::string, std::vector<uint8_t>*> files_; |
119 }; | 120 }; |
120 | 121 |
121 // Some static state is held outside of the DevFS class so that we don't | 122 // Some static state is held outside of the DevFS class so that we don't |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 } | 362 } |
362 | 363 |
363 JSONObject jsobj(js); | 364 JSONObject jsobj(js); |
364 jsobj.AddProperty("type", "FSFile"); | 365 jsobj.AddProperty("type", "FSFile"); |
365 jsobj.AddPropertyBase64("fileContents", | 366 jsobj.AddPropertyBase64("fileContents", |
366 &((*file_contents)[0]), | 367 &((*file_contents)[0]), |
367 file_contents->size()); | 368 file_contents->size()); |
368 } | 369 } |
369 | 370 |
370 } // namespace dart | 371 } // namespace dart |
OLD | NEW |