/storage/sdcard, /sdcard, /mnt/sdcard 三者的區別


public static final String SDPATH = Environment .getExternalStorageDirectory().getAbsolutePath();
//獲取外部存儲的路徑返回絕對路徑的,其實就是你的SD卡的文件路徑

 

/storage/sdcard
/sdcard
/mnt/sdcard

以上三者的區別?

/sdcard是/mnt/sdcard的符號鏈,指向/mnt/sdcard,

/storage/sdcard 是sdcard的分區……

 

/sdcard/: this is a symlink to...
/mnt/sdcard (Android < 4.0)
/storage/sdcard0 (Android 4.0+)

 

  • /storage/emulated/0/: to my knowledge, this refers to the "emulated MMC" ("owner part"). Usually this is the internal one. The "0" stands for the user here, "0" is the first user aka device-owner. If you create additional users, this number will increment for each.
  • /storage/emulated/legacy/ as before, but pointing to the part of the currently working user (for the owner, this would be a symlink to /storage/emulated/0/). So this path should bring every user to his "part".
  • /sdcard/: According to a comment by Shywim, this is a symlink to...
    • /mnt/sdcard (Android < 4.0)
    • /storage/sdcard0 (Android 4.0+)
  • /storage/sdcard0/: As there's no legacy pendant here (see comments below), the "0" in this case rather identifies the device (card) itself. One could, eventually, connect a card reader with another SDCard via OTG, which then would become /storage/sdcard1 (no proof for that, just a guess -- but I'd say a good one)

 

internal storage - Confused by the many locations of the virtual /sdcard/ - Android Enthusiasts Stack Exchange
http://android.stackexchange.com/questions/39542/confused-by-the-many-locations-of-the-virtual-sdcard


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM