How do I get the absolute path of DocumentsLibrary in Win8/Metro/WinRT?

拟墨画扇 提交于 2019-12-02 00:55:13

问题


I have my manifestappx file setup to have access to Documents Library Access and a file association, but when I call

Windows::Storage::KnownFolders::DocumentsLibrary->Path 

Path returns a blank string. How do I get the path to return properly?

Thanks in advance for the help


回答1:


Because DocumentsLibrary is a virtual location representing a collection of different locations and files, it will not have a path:

Libraries, a concept introduced in Windows 7, allow users to view related user content from a single location. Because the library is a virtual location, folders that are added to or removed from a library continue to exist in their original locations as well.

In addition, the MSDN documentation for StorageFolder.Path states:

Do not rely on this property to access a folder because some folders may not have file-system paths. For example if the folder is a file group, or is backed by a URI, or was picked using the file picker, the folder is not guaranteed to have a file-system path.



来源:https://stackoverflow.com/questions/11302799/how-do-i-get-the-absolute-path-of-documentslibrary-in-win8-metro-winrt

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