MCPcopy Create free account
hub / github.com/ElyPrismLauncher/Launcher / read_lock_File

Function read_lock_File

launcher/Application.cpp:264–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262} // namespace
263
264std::tuple<QDateTime, QString, QString, QString, QString> read_lock_File(const QString& path)
265{
266 auto contents = QString(FS::read(path));
267 auto lines = contents.split('\n');
268
269 QDateTime timestamp;
270 QString from, to, target, data_path;
271 for (auto line : lines) {
272 auto index = line.indexOf("=");
273 if (index < 0)
274 continue;
275 auto left = line.left(index);
276 auto right = line.mid(index + 1);
277 if (left.toLower() == "timestamp") {
278 timestamp = QDateTime::fromString(right, Qt::ISODate);
279 } else if (left.toLower() == "from") {
280 from = right;
281 } else if (left.toLower() == "to") {
282 to = right;
283 } else if (left.toLower() == "target") {
284 target = right;
285 } else if (left.toLower() == "data_path") {
286 data_path = right;
287 }
288 }
289 return std::make_tuple(timestamp, from, to, target, data_path);
290}
291
292Application::Application(int& argc, char** argv) : QApplication(argc, argv)
293{

Callers 1

ApplicationMethod · 0.70

Calls 2

readFunction · 0.85
QStringClass · 0.70

Tested by

no test coverage detected