MCPcopy Create free account
hub / github.com/XorTroll/uLaunch / FindRootFolderPath

Function FindRootFolderPath

libs/uCommon/source/ul/menu/menu_Entries.cpp:136–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134 }
135
136 std::string FindRootFolderPath(const std::string &folder_name) {
137 UL_FS_FOR(V100_V110MenuPath, entry_name, entry_path, is_dir, is_file, {
138 if(is_file && util::StringEndsWith(entry_name, ".m.json")) {
139 util::JSON folder_json;
140 if(R_SUCCEEDED(util::LoadJSONFromFile(folder_json, entry_path))) {
141 const auto type = static_cast<EntryType>(folder_json.value("type", static_cast<u32>(EntryType::Invalid)));
142 if(type == EntryType::Folder) {
143 const auto name = folder_json.value("name", "");
144 const auto fs_name = folder_json.value("fs_name", "");
145 if(folder_name == name) {
146 return fs::JoinPath(V100_V110MenuPath, fs_name);
147 }
148 }
149 }
150 }
151 });
152
153 // Not existing, create it
154 const auto new_folder_idx = FindNextEntryIndex(V100_V110MenuPath);
155 const auto new_folder_entry = CreateFolderEntry(V100_V110MenuPath, folder_name, new_folder_idx);
156 return fs::JoinPath(V100_V110MenuPath, new_folder_entry.folder_info.fs_name);
157 }
158
159 void InitializeRemainingEntries(const std::vector<NsExtApplicationRecord> &remaining_apps, u32 &entry_idx) {
160 const std::vector<std::string> DefaultHomebrewRecordPaths = { HbmenuPath, ManagerPath };

Callers 1

ConvertPreV100MenuFunction · 0.85

Calls 5

StringEndsWithFunction · 0.85
LoadJSONFromFileFunction · 0.85
JoinPathFunction · 0.85
FindNextEntryIndexFunction · 0.85
CreateFolderEntryFunction · 0.85

Tested by

no test coverage detected