File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1284,11 +1284,23 @@ xy_detect_os ()
12841284 }
12851285 }
12861286
1287- // REF: https://android.googlesource.com/platform/system/core/+/refs/heads/main/rootdir/init.environ.rc.in
1287+ FILE * fp = fopen ("/proc/version" , "r" );
1288+ if (fp )
1289+ {
1290+ char buf [256 ] = {0 };
1291+ fread (buf , 1 , sizeof (buf ) - 1 , fp );
1292+ fclose (fp );
1293+ if (strstr (buf , "Linux" ))
1294+ {
1295+ xy .on_linux = true;
1296+ return ;
1297+ }
1298+ }
1299+
1300+ // @consult https://android.googlesource.com/platform/system/core/+/refs/heads/main/rootdir/init.environ.rc.in
12881301 char * android_env = getenv ("ANDROID_ROOT" );
12891302 if (xy_str_find (android_env , "/system" ).found )
12901303 {
1291- xy .on_linux = true;
12921304 xy .on_android = true;
12931305 return ;
12941306 }
@@ -1303,6 +1315,7 @@ xy_detect_os ()
13031315 {
13041316 xy .on_macos = true;
13051317 closedir (d );
1318+ return ;
13061319 }
13071320 }
13081321
@@ -1324,6 +1337,7 @@ xy_detect_os ()
13241337 pclose (fp );
13251338 if (strstr (buf , "BSD" ) != NULL )
13261339 xy .on_bsd = true;
1340+ return ;
13271341 }
13281342
13291343 if (!(xy .on_windows || xy .on_linux || xy .on_android || xy .on_macos || xy .on_bsd ))
You can’t perform that action at this time.
0 commit comments