We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
不知道能否支持从Uri或者字符串读取数据?UWP中无法使用C:/...这种路径。
The text was updated successfully, but these errors were encountered:
@HALOCORE 能否提供一段示例代码,我需要参考一下在UWP中如何正确地使用文件路径:)
Sorry, something went wrong.
谢谢回复!在UWP中通常没有读写任意路径的权限,只能访问特定的路径(可读写访问应用数据路径**~\AppData\Local\Packages\程序包标识\LocalState**,可只读访问应用安装路径**C:\Program Files\WindowsApps\程序包标识**)。这些路径可从运行时常量访问,例如应用数据路径可从常量 ApplicationData.Current.LocalFolder得到。
的一段从AppData中的LocalState读取文件代码的例子如下:
StorageFolder _storageFolder = ApplicationData.Current.LocalFolder; Stream fs = await _storageFolder.OpenStreamForReadAsync("Cookie.txt") as Stream; StreamReader sw = new StreamReader(fs); string content = await sw.ReadToEndAsync(); sw.Dispose(); fs.Dispose();
此外,对于必须通过url获取本地文件的情形(一些控件的src,WebView内部),可以访问UWP应用的安装路径,如:
ms-appx-web:///安装目录下的文件 ms-appx:///安装目录下的文件 ms-appdata://应用数据文件 ...
似乎UWP有自己的一套StorageFolder和StorageFile以及Stream/RandomAccessStream抽象,在命名空间
using Windows.Storage; using Windows.Storage.Streams;
中,如果用传统的文件读写方式,一个是不知道应用安装在哪里,另一个就是读写没权限会失败。这似乎是一个棘手的问题。
个人猜测,在Unity3D和Xamarin中的也都有各自的一套文件读写机制,不知道从更一般的字符串数据初始化jieba.NET是否可能同时支持这些平台?
有一说一确实。 要是能直接从内存里读数据就方便了。我现在也是得把数据保存到本地再读取……
No branches or pull requests
不知道能否支持从Uri或者字符串读取数据?UWP中无法使用C:/...这种路径。
The text was updated successfully, but these errors were encountered: