MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / rawBackupFile

Function rawBackupFile

3ds/source/io.cpp:45–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43static const u32 RES_FS_PAST_DATA = 0xD900458B;
44
45static std::u16string rawBackupFile(const std::u16string& folder)
46{
47 std::u16string canonical = folder + StringUtils::UTF8toUTF16("00000001.sav");
48 if (io::fileExists(Archive::sdmc(), canonical)) {
49 return canonical;
50 }
51
52 Directory dir(Archive::sdmc(), folder);
53 if (!dir.good()) {
54 return canonical;
55 }
56 std::u16string only;
57 for (size_t i = 0, sz = dir.size(); i < sz; i++) {
58 if (dir.folder(i)) {
59 continue;
60 }
61 if (!only.empty()) {
62 // More than one candidate: stay with the canonical name so the
63 // failure names the file Checkpoint expects.
64 return canonical;
65 }
66 only = folder + dir.entry(i);
67 }
68 return only.empty() ? canonical : only;
69}
70
71bool io::fileExists(const std::string& path)
72{

Callers 1

restoreMethod · 0.85

Calls 5

goodMethod · 0.45
sizeMethod · 0.45
folderMethod · 0.45
emptyMethod · 0.45
entryMethod · 0.45

Tested by

no test coverage detected