英文:
get absolute file path on android .net MAUI
问题
如何获取Android上文件的绝对路径?文件选择器只提供了该文件的缓存路径,这是无用的。我不想使用OpenReadAsync复制文件,因为这可能会导致应用数据变得比必要的更大。有没有其他办法?
英文:
how to get the absolute path of a file on android? the file picker only gives you the cached path of that file which is useless. i don't want to have to copy the file using OpenReadAsync which could lead to app data getting bigger than necessary .is there anyway?
答案1
得分: 0
这似乎是MAUI essentials API的一个错误,因为Android引入了一个新的权限,应该允许应用程序在需要时直接访问文件存储,并且用户允许应用程序这样做。然而,即使应用程序获得了权限,essentials API 也不尝试进行直接读取/写入。
在此处查看并跟踪此问题:https://github.com/dotnet/maui/issues/6015
与此同时,我还在问题评论中发布了一个临时解决方案,直到这个问题得到解决。
英文:
This seems to be a bug with the MAUI essentials API as Android introduced a new permission that should allow applications direct access to file stores if they need it and the user allows the application to do so. However, even with the permission given to the application, the essentials API does not attempt a direct read / write.
Check out and track the issue here: https://github.com/dotnet/maui/issues/6015
I've also posted a work around in the issue comments in the mean time, until this is addressed.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论