mirror of
https://github.com/Lizonghang/prima.cpp.git
synced 2025-09-06 02:19:04 +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
|
||||
return "Windows";
|
||||
#elif __linux__
|
||||
std::ifstream versionFile("/proc/version");
|
||||
if (versionFile.is_open()) {
|
||||
std::string line;
|
||||
std::getline(versionFile, line);
|
||||
versionFile.close();
|
||||
if (line.find("Android") != std::string::npos) {
|
||||
return "Android";
|
||||
}
|
||||
if (std::getenv("ANDROID_ROOT") != nullptr && std::getenv("PREFIX") != nullptr) {
|
||||
return "Android"; // Termux env in Android
|
||||
}
|
||||
return "Linux";
|
||||
#elif __APPLE__ || __MACH__
|
||||
|
|
Loading…
Add table
Reference in a new issue