Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » UppHub » [SysInfo - Improvement - Koldo] Better way to find distribution version & more
[SysInfo - Improvement - Koldo] Better way to find distribution version & more [message #40951] Sun, 13 October 2013 00:11 Go to previous message
Klugier is currently offline  Klugier
Messages: 1076
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello Koldo,

I found a better way to find distribution version. I have replace function "GetOsInfo_CheckLsb" to "GetOsInfoCheckRelease".

static bool GetOsInfoCheckRelease(String &distro, String &distVersion) {
	StringParse release;
	for (FindFile ff(AppendFileName("/etc/", "*-release")); ff; ff.Next())
		release += LoadFile_Safe(ff.GetPath());
	
	if (release.IsEmpty())
		return false;
	if (!release.GoAfter("DISTRIB_ID="))
		return false;				
	distro = release.GetText();
	if (distro.IsEmpty())
		return false;
	
	release.GoAfter_Init("VERSION=");
	distVersion = release.GetText();

	return true;
}


I enclose full source file with additional changes (SysInfo/os.cpp).

P.S.
Are you sure about this assignation "distro = ubuntu" or "distro=fedora" (Shouldn't it be "Ubuntu" or "Fedora")? BTW, my version uses big letter notation.

Sincerely,
Klugier
  • Attachment: os.cpp
    (Size: 14.29KB, Downloaded 457 times)


U++ - one framework to rule them all.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Problem with FileBrowser
Next Topic: AES for sqlite database
Goto Forum:
  


Current Time: Thu Apr 25 00:27:50 CEST 2024

Total time taken to generate the page: 0.04413 seconds