mirror of
https://github.com/Lizonghang/prima.cpp.git
synced 2025-09-06 19:19:03 +00:00
fix device os detect
This commit is contained in:
parent
6761ca5358
commit
c19891f7db
1 changed files with 2 additions and 8 deletions
|
@ -75,14 +75,8 @@ const char * device_os() {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return "Windows";
|
return "Windows";
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
std::ifstream versionFile("/proc/version");
|
if (std::getenv("ANDROID_ROOT") != nullptr && std::getenv("PREFIX") != nullptr) {
|
||||||
if (versionFile.is_open()) {
|
return "Android"; // Termux env in Android
|
||||||
std::string line;
|
|
||||||
std::getline(versionFile, line);
|
|
||||||
versionFile.close();
|
|
||||||
if (line.find("Android") != std::string::npos) {
|
|
||||||
return "Android";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return "Linux";
|
return "Linux";
|
||||||
#elif __APPLE__ || __MACH__
|
#elif __APPLE__ || __MACH__
|
||||||
|
|
Loading…
Add table
Reference in a new issue