0

I'm trying to open a file in a Chrome packaged-app using chrome.fileSystem.chooseEntry() but I can't manage to make the dialog show a suggested filename (passed through suggestedName). That works ok if the file is in home path, but doesn't if I 'suggest' a file that's inside a folder in that same home folder. I'm on LinuxMint. So:

chrome.fileSystem.chooseEntry({type: 'openFile', suggestedName: "~/log.txt"}, callback) ---> works! but,

chrome.fileSystem.chooseEntry({type: 'openFile', suggestedName: "~/foo/log.txt"}, callback) ---> doesn't! It just opens dialog showing home folder. Both file and folder exist.
4

1 回答 1

3

这是设计使然。文件系统 API 从建议的名称中去除路径信息。换句话说,您可以建议名称但不能建议路径。

我们这样做是出于安全原因;我们希望用户始终选择文件。如果您的应用有正当理由建议路径,请在http://crbug.com提交错误,描述您的用例并抄送我。

于 2013-05-27T05:35:27.703 回答