Is there a method available for UWP apps to get available disk space

本小妞迷上赌 提交于 2019-12-21 23:17:52

问题


I am working on a UWP app that depends on available storage space, and would like to have that information prior to a save fail. I have tried the RetrievePropertiesAsync calls on the known folders, but do not get a Freespace or Capacity property in the resultant list. Is there a method available for this?

Code used to access properties:

auto basicProperties = co_await videosFolder->GetBasicPropertiesAsync();
auto retrievedProperties = co_await basicProperties->RetrievePropertiesAsync(propertiesToRetrieve);
unsigned long freeSpace = retrievedProperties->Size;
auto it = retrievedProperties->First();
bool validData = (it != nullptr);
while (validData)
{
    String^ text = it->Current->Key;
    validData = it->MoveNext();
}

来源:https://stackoverflow.com/questions/43056945/is-there-a-method-available-for-uwp-apps-to-get-available-disk-space

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