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

Method fallback_lsb_info

libraries/systeminfo/src/distroutils.cpp:122–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122bool Sys::fallback_lsb_info(Sys::LsbInfo & out)
123{
124 // running lsb_release failed, try to read the file instead
125 // /etc/lsb-release format, if the file even exists, is non-standard.
126 // Only the `lsb_release` command is specified by LSB. Nonetheless, some
127 // distributions install an /etc/lsb-release as part of the base
128 // distribution, but `lsb_release` remains optional.
129 QString file = "/etc/lsb-release";
130 if (QFile::exists(file))
131 {
132 QSettings settings(file, QSettings::IniFormat);
133 if(settings.contains("DISTRIB_ID"))
134 {
135 out.distributor = settings.value("DISTRIB_ID").toString().toLower();
136 }
137 if(settings.contains("DISTRIB_RELEASE"))
138 {
139 out.version = settings.value("DISTRIB_RELEASE").toString().toLower();
140 }
141 return !out.distributor.isEmpty();
142 }
143 return false;
144}
145
146void Sys::lsb_postprocess(Sys::LsbInfo & lsb, Sys::DistributionInfo & out)
147{

Callers

nothing calls this directly

Calls 3

isEmptyMethod · 0.80
containsMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected