在部署在Hololens上的Unity UWP应用程序中使用StorageFolder的问题。

问题描述 投票:0回答:1

我想在hololens上的Unity、UWP应用中访问一个SMB共享驱动器,我试着按照下面链接中的方法去做。

如何在UWP中访问本地网络(SMB)?

我已经在Package.appxmanifest中定义了所需的(Capabilities,Share Targets和File Type Associations),你可以在下面的截图中看到。

enter image description here

在我的Unity脚本中,我定义了以下内容。

if ENABLE_WINMD_SUPPORT && !UNITY_EDITOR。

StorageFolder folder = await StorageFolder.GetFolderFromPathAsync(@"\\DESKTOP2GEQQ3D\FolderModels");

await "再也没有返回,我收到了以下错误。

"FileNotFoundException: Unable to find specified file.".

有什么想法,为什么 "等待 "永远不返回,永远卡住?当然,如果StorageFolder不能访问 "FolderModels",我会收到 "UnauthorizedAccessException "错误。

我的SMB共享驱动器对所有其他网络都是可见的,我的Hololens与SMB共享驱动器在同一个网络上......我已经没有办法了......。

unity3d uwp hololens smb storagefolder
1个回答
0
投票

你参考的解决方案并不完全正确。我建议你在MSDN论坛中查看答案。链接.

修复要点如下。

  1. 我们访问网络硬盘所需的正确能力已经描述过了。此处

    请仔细检查 《通用命名公约》(UNC)文件夹 部分.Proximity功能在我们的情况下是不相关的。

  2. 我们需要设置的Share Target声明并不正确。相反,请添加 File Type Associations 声明,请看官方指导。处理文件的激活

例如,如果我们需要访问SMB文件夹中的.jpg和.txt文件,就添加能力。

<Capability Name="internetClient" />
<Capability Name="privateNetworkClientServer"/>
<uap:Capability Name="enterpriseAuthentication"/>
<Capability Name="internetClientServer"/>

并设置 File Type Associations 声明:

<uap:Extension Category="windows.fileTypeAssociation">
          <uap:FileTypeAssociation Name="smbfolder">
            <uap:SupportedFileTypes>
              <uap:FileType>.txt</uap:FileType>
              <uap:FileType>.jpg</uap:FileType>
            </uap:SupportedFileTypes>
            <uap:DisplayName>SMBFolder</uap:DisplayName>
          </uap:FileTypeAssociation>
        </uap:Extension>
© www.soinside.com 2019 - 2024. All rights reserved.