-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add lsb release code name to the LD_LIBRARY_PATH Use local Qt library only when is greater than system
- Loading branch information
1 parent
d98683f
commit 6f55ca6
Showing
5 changed files
with
61 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include "LSBRelease.h" | ||
|
||
#include <cstdio> | ||
#include <cstring> | ||
|
||
LSBRelease::LSBRelease() { | ||
FILE *fp = fopen("/etc/lsb-release", "rb"); | ||
if (fp == nullptr) | ||
return; | ||
|
||
char key[128]; | ||
char value[128]; | ||
|
||
key[127] = value[127] = 0; | ||
|
||
while (fscanf(fp, "%127[^=]=%127[^\n]\n", key, value) == 2) { | ||
if (strncmp(key, "DISTRIB_ID", 128) == 0) { | ||
id = value; | ||
} else if (strncmp(key, "DISTRIB_RELEASE", 128) == 0) { | ||
release = value; | ||
} else if (strncmp(key, "DISTRIB_CODENAME", 128) == 0) { | ||
code_name = value; | ||
} else if (strncmp(key, "DISTRIB_DESCRIPTION", 128) == 0) { | ||
description = value; | ||
if (description.front() == '"' && description.back() == '"') { | ||
description.erase(0, 1); | ||
description.pop_back(); | ||
} | ||
} | ||
} | ||
|
||
fclose(fp); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef LSBRELEASE_H | ||
#define LSBRELEASE_H | ||
|
||
#include <string> | ||
|
||
struct LSBRelease { | ||
LSBRelease(); | ||
std::string id{}; | ||
std::string release{}; | ||
std::string code_name{}; | ||
std::string description{}; | ||
}; | ||
|
||
#endif // LSBRELEASE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters