[英]Can't access file on OneDrive; HoloLens runtime
I started working with the Microsoft HoloLens.我开始使用 Microsoft HoloLens。
I am completely new to C# programming.我对 C# 编程完全陌生。 So this could be a simple or even stupid question, but I just can't explain it and couldn't find any information about it.
所以这可能是一个简单甚至愚蠢的问题,但我无法解释它,也找不到任何关于它的信息。 I work with Unity 2018.4.21f1 Visual Studio 2019 and the already mentioned HoloLens.
我使用 Unity 2018.4.21f1 Visual Studio 2019 和已经提到的 HoloLens。
I would like to program an app that opens a FileExplorer where I can select OneDrive from the drop down menu, choose a.obj-file (let's take cube.obj as an example) and this file gets processed and rendered at runtime.我想编写一个打开 FileExplorer 的应用程序,我可以在其中 select OneDrive 从下拉菜单中选择 a.obj 文件(我们以 cube.obj 为例),这个文件在运行时得到处理和渲染。
I can use a FileOpenPicker to select a file from OneDrive, but then the following error message appears:我可以使用 FileOpenPicker 来 select 来自 OneDrive 的文件,但随后出现以下错误消息:
Exception thrown at 0x76C330D2 in APP.exe: Microsoft C++ exception: Il2CppExceptionWrapper at memory location 0x0210C090.
在 APP.exe 中的 0x76C330D2 处引发异常:Microsoft C++ 异常:Il2CppExceptionWrapper 在 memory 位置 0x0210C090。 DirectoryNotFoundException: Could not find a part of the path "C:\Data\Users\marcu\AppData\Local\Packages\microsoft.microsoftskydrive_8wekyb3d8bbwe\LocalState\OpenFile\cube.obj".
DirectoryNotFoundException:找不到路径“C:\Data\Users\marcu\AppData\Local\Packages\microsoft.microsoftskydrive_8wekyb3d8bbwe\LocalState\OpenFile\cube.obj”的一部分。
If someone had a similar problem and could help me to solve this one or could give me a hint, I would be very grateful.如果有人有类似的问题并且可以帮助我解决这个问题或者可以给我一个提示,我将非常感激。
UWP apps can only access certain file system locations by default such as ApplicationData
and Package.InstalledLocation
. UWP 应用程序默认只能访问某些文件系统位置,例如
ApplicationData
和Package.InstalledLocation
。 Unfortunately, you cannot directly access the files in OneDrive through the path.遗憾的是,您无法通过该路径直接访问 OneDrive 中的文件。
But you can copy this file from OneDrive to ApplicationData.Current.LocalFolder
by calling the method StorageFile.CopyAsync()
.但是您可以通过调用
StorageFile.CopyAsync()
方法将此文件从 OneDrive 复制到ApplicationData.Current.LocalFolder
。 Because the LocalFolder is the folder where your app can store data freely and be created when your app is installed, you can access this file from LocalFolder by the string path.因为LocalFolder是你的应用可以自由存储数据的文件夹,在你的应用安装时创建,你可以通过字符串路径从LocalFolder访问这个文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.