问题
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