2

运行 adb shell,查找到 /mnt/shell/emulated/0 的旧链接但是 getCanonicalPath 无法获取 /mnt/shell/emulated/0?

shell@android:/storage/emulated $ ls -l lrwxrwxrwx root root 2012-12-07 12:01 legacy -> /mnt/shell/emulated/0

File file = new File("/storage/emulated/legacy");
String pachString = null;
try {
    pachString = file.getCanonicalPath();
        // prints /storage/emulated/legacy
} catch (IOException e) {
    e.printStackTrace();
}
4

1 回答 1

2

壳@安卓:/mnt $ ls -l /mnt/

ls -l /mnt/ 
drwxr-xr-x root     system            2013-03-13 16:31 asec 
drwxr-xr-x root     system            2013-03-13 16:31 obb 
lrwxrwxrwx root     root              2013-03-13 16:31 sdcard -> /storage/emulated/legacy 
drwx------ root     root              2013-03-13 16:31 secure 
drwx------ shell    shell             2013-03-13 16:31 shell 

'/mnt/shell'目录仅接受外壳

所以应用程序不能read /mnt/shell

于 2013-03-14T06:04:59.907 回答