I'm not sure if you're using exactly the code that you pasted here, but it doesn't appear to be doing anything when the user actually chooses something. If you were to pick something using the input then call chooseFiles()
it should work. At least it did in my nw.js app I quickly set up.
If you want the files to appear in console.log()
when the user completes their selection, I think you should be able to do it using the code below:
<html>
<head>
<script src="jquery.js"></script>
<script>
$(function () {
$("#fileDialog").on("change", function () {
var files = $(this)[0].files;
for (var i = 0; i < files.length; ++i) {
console.log(files[i].path);
}
});
});
</script>
</head>
<body>
<input type="file" id="fileDialog" nwdirectory />
</body>
</html>
If you want the files to be logged immediately when user selects a directory using the file dialog, I think the on("change")
might be what you're looking for. It worked for me using nw.js v0.12 so give it a shot and see if that is what you're looking for.