Reputation: 11
I created file keywords in the same directory where is extension.js When i try read, it's not finded.
fs.readFile(path.resolve("~/keywords"), 'utf8', (a, b) => {
if (a) {
vscode.window.showInformationMessage('fail: ', a)
return
}
vscode.window.showInformationMessage('ok')
words = JSON.parse(b)
})
Upvotes: 1
Views: 1256
Reputation: 4702
To access files in the same working directory as the script calling them, use:
('./file.js')
And to access 1 level below, use:
('../lib/file.js')
Upvotes: 1