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
Re: [SysInfo - Improvement - Koldo] Better way to find distribution version & more [message #40955 is a reply to message #40954] Sun, 13 October 2013 01:58 Go to previous messageGo to previous message
Klugier is currently offline  Klugier
Messages: 1076
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Here is the final version of the function:
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 = ToLower(release.GetText());
	
	if (distro.IsEmpty())
		return false;
	
	release.GoAfter_Init("DISTRIB_RELEASE=");
	distVersion = release.GetText();

	return true;
}


I don't want to change current functionality, so i decided to stay with old qualifiers. In the future we can get more informations about distribution (with my extension). It is up to you.

P.S.
Moreover, you can change LoadFile_Safe function (Functions4U) to:
String LoadFile_Safe(const String& fileName);


insted of:

String LoadFile_Safe(String fileName);




U++ - one framework to rule them all.

[Updated on: Sun, 13 October 2013 13:06]

Report message to a moderator

 
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: Sat May 04 21:30:21 CEST 2024

Total time taken to generate the page: 0.01824 seconds