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

Method loadBackupList

3ds/source/title.cpp:147–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147void Title::loadBackupList(const std::u16string& basePath, const std::vector<std::u16string>& additionalFolders, bool descending,
148 std::vector<std::u16string>& names, std::vector<std::u16string>& fullPaths)
149{
150 Directory baselist(Archive::sdmc(), basePath);
151 if (baselist.good()) {
152 for (size_t i = 0, sz = baselist.size(); i < sz; i++) {
153 if (baselist.folder(i)) {
154 names.push_back(baselist.entry(i));
155 fullPaths.push_back(basePath + StringUtils::UTF8toUTF16("/") + baselist.entry(i));
156 }
157 }
158
159 if (descending) {
160 std::sort(names.rbegin(), names.rend());
161 std::sort(fullPaths.rbegin(), fullPaths.rend());
162 }
163 else {
164 std::sort(names.begin(), names.end());
165 std::sort(fullPaths.begin(), fullPaths.end());
166 }
167 names.insert(names.begin(), StringUtils::UTF8toUTF16("New..."));
168 fullPaths.insert(fullPaths.begin(), StringUtils::UTF8toUTF16("New..."));
169 }
170 else {
171 Logging::error("Couldn't retrieve the directory list for the title {}", shortDescription());
172 }
173
174 // backups from configured additional folders, appended unsorted after "New..."
175 try {
176 for (const auto& folder : additionalFolders) {
177 if (!io::directoryExists(Archive::sdmc(), folder)) {
178 Logging::error("Additional folder does not exist: {}", StringUtils::UTF16toUTF8(folder));
179 continue;
180 }
181 Directory list(Archive::sdmc(), folder);
182 if (!list.good()) {
183 Logging::error("Additional folder is not good: {}", StringUtils::UTF16toUTF8(folder));
184 continue;
185 }
186 for (size_t i = 0, sz = list.size(); i < sz; i++) {
187 if (list.folder(i)) {
188 names.push_back(list.entry(i));
189 fullPaths.push_back(folder + StringUtils::UTF8toUTF16("/") + list.entry(i));
190 }
191 }
192 }
193 }
194 catch (const std::exception& e) {
195 Logging::error("Exception when processing additional folders: {}", e.what());
196 }
197 catch (...) {
198 Logging::error("Unknown exception when processing additional folders for title {:X}", mId);
199 }
200}
201
202void Title::refreshDirectories(void)
203{

Callers

nothing calls this directly

Calls 12

errorFunction · 0.85
rbeginMethod · 0.80
rendMethod · 0.80
whatMethod · 0.80
goodMethod · 0.45
sizeMethod · 0.45
folderMethod · 0.45
push_backMethod · 0.45
entryMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected