如何在Win8/Metro/WinRT中获取DocumentsLibrary的绝对路径? [英] How do I get the absolute path of DocumentsLibrary in Win8/Metro/WinRT?

查看:60
本文介绍了如何在Win8/Metro/WinRT中获取DocumentsLibrary的绝对路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我具有manifestappx文件设置,可以访问文档库访问"和文件关联,但是当我致电

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返回一个空字符串.如何获得正确返回的路径?

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

预先感谢您的帮助

推荐答案

因为

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

库是Windows 7中引入的概念,允许用户查看 单个位置的相关用户内容.因为图书馆是一个 虚拟位置,添加到库中或从库中删除的文件夹 仍然存在于其原始位置.

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.

此外, MSDN文档对于StorageFolder.Path 状态:

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

请勿依赖此属性访问文件夹,因为某些文件夹 可能没有文件系统路径.例如,如果文件夹是文件 组,或者由URI支持,或者是使用文件选择器选择的 不能保证文件夹具有文件系统路径.

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.

这篇关于如何在Win8/Metro/WinRT中获取DocumentsLibrary的绝对路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆