Skip to content

Commit b5cf57b

Browse files
author
Mikachu2333
committed
fix(lib): 修复 Android 系统检测逻辑
1 parent bbeb1ef commit b5cf57b

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lib/xy.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,13 +1284,14 @@ xy_detect_os ()
12841284
}
12851285
}
12861286

1287-
char *android_env = getenv ("ANDROID_ROOT");
1288-
if (android_env == "/system")
1289-
{
1290-
xy.on_linux = true;
1291-
xy.on_android = true;
1292-
return;
1293-
}
1287+
// REF: https://android.googlesource.com/platform/system/core/+/refs/heads/main/rootdir/init.environ.rc.in
1288+
char *android_env = getenv ("ANDROID_ROOT");
1289+
if (xy_str_find (android_env, "/system").found)
1290+
{
1291+
xy.on_linux = true;
1292+
xy.on_android = true;
1293+
return;
1294+
}
12941295

12951296
/* 判断 macOS */
12961297
DIR *d = opendir ("/System/Applications");

0 commit comments

Comments
 (0)