MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / toDirent

Method toDirent

lib/vfs/machfs.cc:198–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196
197private:
198 std::shared_ptr<Dirent> toDirent(hfsdirent& de, const Path& parent)
199 {
200 auto dirent = std::make_shared<Dirent>();
201 dirent->filename = de.name;
202 dirent->path = parent;
203 dirent->path.push_back(de.name);
204 if (de.flags & HFS_ISDIR)
205 dirent->file_type = TYPE_DIRECTORY;
206 else
207 {
208 dirent->file_type = TYPE_FILE;
209 dirent->length =
210 de.u.file.dsize + de.u.file.rsize + AppleSingle::OVERHEAD;
211 }
212 dirent->mode = (de.flags & HFS_ISLOCKED) ? "L" : "";
213
214 dirent->attributes[FILENAME] = de.name;
215 dirent->attributes[LENGTH] = "0";
216 dirent->attributes[FILE_TYPE] = (de.flags & HFS_ISDIR) ? "dir" : "file";
217 dirent->attributes[MODE] = (de.flags & HFS_ISLOCKED) ? "L" : "";
218 dirent->attributes["machfs.ctime"] = toIso8601(de.crdate);
219 dirent->attributes["machfs.mtime"] = toIso8601(de.mddate);
220 dirent->attributes["machfs.last_backup"] = toIso8601(de.bkdate);
221 dirent->attributes["machfs.finder.x"] = std::to_string(de.fdlocation.h);
222 dirent->attributes["machfs.finder.y"] = std::to_string(de.fdlocation.v);
223 dirent->attributes["machfs.finder.flags"] =
224 fmt::format("0x{:x}", de.fdflags);
225 if (de.flags & HFS_ISDIR)
226 {
227 dirent->attributes["machfs.dir.valence"] =
228 std::to_string(de.u.dir.valence);
229 dirent->attributes["machfs.dir.x1"] =
230 std::to_string(de.u.dir.rect.left);
231 dirent->attributes["machfs.dir.y1"] =
232 std::to_string(de.u.dir.rect.top);
233 dirent->attributes["machfs.dir.x2"] =
234 std::to_string(de.u.dir.rect.right);
235 dirent->attributes["machfs.dir.y2"] =
236 std::to_string(de.u.dir.rect.bottom);
237 }
238 else
239 {
240 dirent->attributes["length"] = fmt::format("{}",
241 de.u.file.dsize + de.u.file.rsize + AppleSingle::OVERHEAD);
242 dirent->attributes["machfs.file.dsize"] =
243 std::to_string(de.u.file.dsize);
244 dirent->attributes["machfs.file.rsize"] =
245 std::to_string(de.u.file.rsize);
246 dirent->attributes["machfs.file.type"] = de.u.file.type;
247 dirent->attributes["machfs.file.creator"] = de.u.file.creator;
248 }
249
250 return dirent;
251 }
252
253 void throwError()
254 {

Callers

nothing calls this directly

Calls 3

toIso8601Function · 0.85
to_stringFunction · 0.85
push_backMethod · 0.45

Tested by

no test coverage detected