【发布时间】:2016-03-05 20:58:53
【问题描述】:
嗨,我正在做一个 Windows 8 Javascript 应用程序,你知道如何从 C:\Users\Me\Pictures\thifolder 获取文件名的 example2.dat 我尝试使用Windows.Storage.StorageFile.getFileFromPathAsync("C:\Users\Me\Pictures\thisfolder");
但它没有用,因为我还有其他文件,例如 example1.dat、example3.dat example.jpg 等。
希望我说清楚了,提前谢谢
这是我目前的代码
function here() {
var getJsonStringAsync = function () {
return Windows.Storage.StorageFile.getFileFromPathAsync("C:\Users\Me\Pictures\thisfolder")
//Also tried this
//return Windows.Storage.KnownFolders.picturesLibrary.getFileAsync(u_u + "_" + u + "_" + ".dat")
.then(function (file) {
return Windows.Storage.FileIO.readTextAsync(file);
});
};
getJsonStringAsync().then(function (text) {
document.getElementById("line").innerHTML = text;
});
}
【问题讨论】:
-
我也想获取文件夹内的文字,希望大家帮忙
标签: windows file windows-runtime directory winjs