如何获得运行android和fast boot的相同存储路径?

如何获得运行android和fast boot的相同存储路径?,android,android-external-storage,Android,Android External Storage,我尝试为我的自定义rom制作更新程序 我使用了一些代码来快速更新 private void flashRom() throws IOException { Process p = Runtime.getRuntime().exec("su"); OutputStream os = p.getOutputStream(); os.write("mkdir -p /cache/recovery/\n".getBytes()); os

我尝试为我的自定义rom制作更新程序

我使用了一些代码来快速更新

private void flashRom() throws IOException {


        Process p = Runtime.getRuntime().exec("su");
        OutputStream os = p.getOutputStream();
        os.write("mkdir -p /cache/recovery/\n".getBytes());
        os.write("echo 'boot-recovery' >/cache/recovery/command\n".getBytes());
        os.write("reboot recovery\n".getBytes());


        os.flush();
    }
一般来说,效果很好。我的问题出现在某些设备上,其中
/sdcard/
被引用为
/mnt/media/
,而
getExternalStorageDir()
为同一设备返回
/storage/simulated/0/。
,我使用下载管理器将文件保存到
request.setDestinationNexternalPublicDir(“rom”、“update.zip”)

我必须在何处保存下载的更新,或者如何确保
getExternalStorageDir()
(或更合适的方法)将返回与fastboot中的
/sdcard/
相同的路径?

我使用了TWRP恢复而不是CWN,并且它正确识别路径