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

Method lsb_postprocess

libraries/systeminfo/src/distroutils.cpp:146–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146void Sys::lsb_postprocess(Sys::LsbInfo & lsb, Sys::DistributionInfo & out)
147{
148 QString dist = lsb.distributor;
149 QString vers = lsb.version;
150 if(dist.startsWith("redhatenterprise"))
151 {
152 dist = "rhel";
153 }
154 else if(dist == "archlinux")
155 {
156 dist = "arch";
157 }
158 else if (dist.startsWith("suse"))
159 {
160 if(lsb.description.startsWith("opensuse"))
161 {
162 dist = "opensuse";
163 }
164 else if (lsb.description.startsWith("suse linux enterprise"))
165 {
166 dist = "sles";
167 }
168 }
169 else if (dist == "debian" and vers == "testing")
170 {
171 vers = lsb.codename;
172 }
173 else
174 {
175 // ubuntu, debian, gentoo, scientific, slackware, ... ?
176#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
177 auto parts = dist.split(QRegularExpression("\\s+"), Qt::SkipEmptyParts);
178#else
179 auto parts = dist.split(QRegularExpression("\\s+"), QString::SkipEmptyParts);
180#endif
181 if(parts.size())
182 {
183 dist = parts[0];
184 }
185 }
186 if(!dist.isEmpty())
187 {
188 out.distributionName = dist;
189 out.distributionVersion = vers;
190 }
191}
192
193Sys::DistributionInfo Sys::read_lsb_release()
194{

Callers

nothing calls this directly

Calls 2

isEmptyMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected