-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OpenFile dialog now works, selects a file and logs name to console.
Co-authored-by: Benjamin Ross <[email protected]>
- Loading branch information
1 parent
38fc288
commit 5ec53b9
Showing
3 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
var fs = require('fs'); | ||
|
||
function openFile () { | ||
|
||
dialog.showOpenDialog(function (fileNames) { | ||
if (fileNames === undefined) return; | ||
|
||
var fileName = fileNames[0]; | ||
|
||
fs.readFile(fileName, 'utf-8', function (err, data) { | ||
console.log("Selected filename " + fileName); | ||
}); | ||
}); | ||
} | ||
|
||
document.querySelector('#fileOpenButton').addEventListener('click', openFile) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters