使用 chrome.fileSystem.chooseEntry 获取打开文件的完整路径
Get full path of a file open using chrome.fileSystem.chooseEntry
我想知道是否有任何方法可以使用 chrome.fileSystem.chooseEntry
获取 fileEntry 的完整路径。我试过使用 chrome.fileSystem.getFullPath
但它 returns 是一个空字符串。
我应该怎么做才能获得文件条目的完整路径?
谢谢
文档页面未列出 chrome.fileSystem.getFullPath
,仅列出 chrome.fileSystem.getDisplayPath:
chrome.fileSystem.chooseEntry({type: 'openFile', accepts: accepts}, function(entry) {
if (!entry) {
console.log("Cancelled");
return;
}
// All of Chrome API is asynchronous! Use callbacks:
chrome.fileSystem.getDisplayPath(entry, function(path) {
console.log(path);
// do something with path
});
}
有大量 chrome 应用展示了 API 在 github 上的用法:chrome-app-samples。
P.S。 The MDN article for fileEntry
提到 .fullPath
属性 但在这种情况下不起作用。
我想知道是否有任何方法可以使用 chrome.fileSystem.chooseEntry
获取 fileEntry 的完整路径。我试过使用 chrome.fileSystem.getFullPath
但它 returns 是一个空字符串。
我应该怎么做才能获得文件条目的完整路径?
谢谢
文档页面未列出 chrome.fileSystem.getFullPath
,仅列出 chrome.fileSystem.getDisplayPath:
chrome.fileSystem.chooseEntry({type: 'openFile', accepts: accepts}, function(entry) {
if (!entry) {
console.log("Cancelled");
return;
}
// All of Chrome API is asynchronous! Use callbacks:
chrome.fileSystem.getDisplayPath(entry, function(path) {
console.log(path);
// do something with path
});
}
有大量 chrome 应用展示了 API 在 github 上的用法:chrome-app-samples。
P.S。 The MDN article for fileEntry
提到 .fullPath
属性 但在这种情况下不起作用。