MCPcopy Create free account
hub / github.com/MITK/MITK / readProvisioningFile

Method readProvisioningFile

Modules/AppUtil/src/mitkProvisioningInfo.cpp:36–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34 QList<QUrl> ProvisioningInfo::getPluginsToInstall() const { return pluginsToInstall; }
35 QList<QUrl> ProvisioningInfo::getPluginsToStart() const { return pluginsToStart; }
36 void ProvisioningInfo::readProvisioningFile(const QString &filePath)
37 {
38 QFile file(filePath);
39 if (!file.open(QFile::ReadOnly))
40 mitkThrow() << "Cannot open provisioning info file: " << filePath.toStdString();
41
42 QTextStream fileStream(&file);
43 QRegularExpression sep("\\s+");
44 QString line;
45 int count = 1;
46 do
47 {
48 line = fileStream.readLine().trimmed();
49 if (!line.isEmpty() && !line.startsWith('#'))
50 {
51 QString keyword = line.section(sep, 0, 0);
52 QString value = line.mid(keyword.size()).trimmed();
53 value = substituteKeywords(value);
54
55 if (keyword.isEmpty())
56 {
57 MITK_WARN << "Keyword missing in line " << count << " of provisioning file " << filePath.toStdString();
58 continue;
59 }
60
61 Keyword key = UNKNOWN;
62 if (keyword.compare("READ", Qt::CaseInsensitive) == 0)
63 {
64 key = READ;
65 }
66 else if (keyword.compare("INSTALL", Qt::CaseInsensitive) == 0)
67 {
68 key = INSTALL;
69 }
70 else if (keyword.compare("START", Qt::CaseInsensitive) == 0)
71 {
72 key = START;
73 }
74 else if (keyword.compare("STOP", Qt::CaseInsensitive) == 0)
75 {
76 key = STOP;
77 }
78
79 if (key == UNKNOWN)
80 {
81 MITK_WARN << "Keyword " << keyword.toStdString() << " in line " << count << " of provisioning file "
82 << filePath.toStdString() << " unknown";
83 continue;
84 }
85
86 if (value.isEmpty())
87 {
88 MITK_WARN << "Value after keyword " << keyword.toStdString() << " missing in line " << count
89 << " of provisioning file " << filePath.toStdString();
90 continue;
91 }
92
93 switch (key)

Callers 1

ProvisioningInfoMethod · 0.95

Calls 5

addPluginToInstallMethod · 0.95
addPluginToStartMethod · 0.95
errorStringMethod · 0.80
openMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected