MCPcopy Create free account
hub / github.com/MultiMC/Launcher / readListFile

Function readListFile

launcher/minecraft/legacy/LegacyModList.cpp:45–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45static OrderList readListFile(const QString &m_list_file)
46{
47 OrderList itemList;
48 if (m_list_file.isNull() || m_list_file.isEmpty())
49 return itemList;
50
51 QFile textFile(m_list_file);
52 if (!textFile.open(QIODevice::ReadOnly | QIODevice::Text))
53 return OrderList();
54
55 QTextStream textStream;
56 textStream.setAutoDetectUnicode(true);
57 textStream.setDevice(&textFile);
58 while (true)
59 {
60 QString line = textStream.readLine();
61 if (line.isNull() || line.isEmpty())
62 break;
63 else
64 {
65 OrderItem it;
66 it.enabled = !line.endsWith(".disabled");
67 if (!it.enabled)
68 {
69 line.chop(9);
70 }
71 it.id = line;
72 itemList.append(it);
73 }
74 }
75 textFile.close();
76 return itemList;
77}
78
79bool LegacyModList::update()
80{

Callers 1

updateMethod · 0.85

Calls 3

isEmptyMethod · 0.80
openMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected