-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Closed
Description
- Output of
node_modules/.bin/electron --version
: v2.0.8 - Operating System (Platform and Version): Ubuntu 18.04 / macOS High Sierra
Expected behavior
When calling fs.copyFile, the source file should be copied to the destination.
Actual behavior
The file doesn't get copied and the following error gets thrown:
Error: ENOTDIR: not a directory, copyfile '/home/amxmln/cpy-tst/dist/linux-unpacked/resources/app.asar/test.txt' -> '/home/amxmln/test.txt'
The file exists in the source location, and the error only happens when the application is packaged in an ASAR archive.
How to reproduce
I've prepared a minimal sample project to illustrate the issue here.
So:
$ git clone https://github.com/amxmln/electron-copy-file-bug.git
$ cd electron-copy-file-bug
$ npm i
$ npm run build
$ ./dist/linux-unpacked/copy-test
Click on the button and check the console. It displays the copy destination (your home folder), the error, and the files fs.readdir sees at the source location (including test.txt, which is the one that was attempted to be copied).
Note that if you run the example without building it with ASAR, by running npm start
the copying works without issue.
WolfWalter and sindresorhus