How to know one StorageFolder-obj belongs to SD or Phone?

你说的曾经没有我的故事 提交于 2020-01-11 09:52:07

问题


Is there have way to know a StorageFolder-obj belongs to SD or Phone on WP8.1? Thanks you.


回答1:


You can do it for example by checking the Path of StorageFolder (or StorageFIle):

string folderPath = yourStorageFolder.Path;
if (folderPath.StartsWith("C:")) // on Phone
else // on SD Card
  • if it begins with D: (or other letter - not C:) - it means it belongs to SD card,
  • if it begins with C: - it exists on Phone,

EDIT - as Adam has said in comments - it may be more suitable to check first if file is on the Phone, in case the System had assigned other letter than D: for SD card.



来源:https://stackoverflow.com/questions/23672320/how-to-know-one-storagefolder-obj-belongs-to-sd-or-phone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!