MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / getRealIndexName

Function getRealIndexName

launcher/modplatform/packwiz/Packwiz.cpp:31–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29namespace Packwiz {
30
31auto getRealIndexName(QDir& index_dir, QString normalized_fname, bool should_find_match) -> QString
32{
33 QFile index_file(index_dir.absoluteFilePath(normalized_fname));
34
35 QString real_fname = normalized_fname;
36 if (!index_file.exists()) {
37 // Tries to get similar entries
38 for (auto& file_name : index_dir.entryList(QDir::Filter::Files)) {
39 if (!QString::compare(normalized_fname, file_name, Qt::CaseInsensitive)) {
40 real_fname = file_name;
41 break;
42 }
43 }
44
45 if (should_find_match && !QString::compare(normalized_fname, real_fname, Qt::CaseSensitive)) {
46 qCritical() << "Could not find a match for a valid metadata file!";
47 qCritical() << "File: " << normalized_fname;
48 return {};
49 }
50 }
51
52 return real_fname;
53}
54
55// Helpers
56static inline auto indexFileName(QString const& mod_slug) -> QString

Callers 3

updateModIndexMethod · 0.85
deleteModIndexMethod · 0.85
getIndexForModMethod · 0.85

Calls 1

existsMethod · 0.80

Tested by

no test coverage detected