Windows运行时应用程序中无法访问长文件路径 [英] Long File path not accessible in Windows runtime app

查看:130
本文介绍了Windows运行时应用程序中无法访问长文件路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio cordova模板开发Windows应用程序。该应用程序针对Windows Surface。



在应用程序中,我尝试从我的服务器下载内容并将其保存为脱机。我通过在应用程序文件夹中创建相同的路径来保存文件。但由于文件路径可能超过256个字符,因此在创建/访问/删除
这些文件路径时,cordova api会失败。最近,Windows 10允许使用win32 api创建长路径(https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx?f=255& MSPPError = -2147217396 #maxpath)但这在javascaript和
中都不可用.cordova api也不支持。

Windows是否会为javascript发布这个api?



我试图通过将应用程序路径挂载到驱动器然后使用此驱动器来保存内容来解决此问题。但在这种方法中,我无法从应用程序访问另一个文件夹(至于访问另一个文件夹,我们必须明确要求用户使用
folderpicker)。



在Windows中基于cordova模板的应用程序中是否还有其他替代支持长文件路径?

I'm using Visual Studio cordova template for developing a Windows application. The application is targeted for windows Surface.

In the application i am trying to download the content from my server and save it offline. I am saving the file by creating the same path inside the application folder. But since file path can be more than 256 characters, cordova api's are failing while creating/accessing/deleting these file paths. Recently windows 10 has allowed to create long path by using win32 api(https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396#maxpath) but that is not available in javascaript and also this will not be supported by cordova api's.
Is Windows going to release this api for javascript?

I am trying to resolve this issue by mounting the app path to drive and then using this drive to save the content. But in this method, I am not able to access the another folder from the app(As to access another folder, we have to explicity ask the user using folderpicker).

Is there any other alternative to support long file path in cordova template based app in windows?

推荐答案

您好knsl,

Hi knsl,

>但由于文件路径可能超过256个字符,因此创建/访问/删除这些文件路径时cordova api失败

>But since file path can be more than 256 characters, cordova api's are failing while creating/accessing/deleting these file paths

是的,请参考
cordova-plugin-file

我们可以看到它实际上使用的是WinRT文件API,比如StorageFolder.GetFileAsync方法,请参阅

https://msdn.microsoft.com/ EN-US /窗/ UWP /文件/快速启动,读取与写入文件s

We can see it actually use the WinRT File API, like StorageFolder.GetFileAsync method, see https://msdn.microsoft.com/en-us/windows/uwp/files/quickstart-reading-and-writing-files

>在Windows中基于cordova模板的应用程序中是否还有其他替代方案可支持长文件路径?

>Is there any other alternative to support long file path in cordova template based app in windows?

文件路径(文件名+扩展名)不应超过 256 个字符。

The file paths (file name + extension) should be not longer than 256 characters.


这篇关于Windows运行时应用程序中无法访问长文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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