Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to copy files into a drive (C:, D:) on Windows #86

Open
kimlimjustin opened this issue Jul 7, 2021 · 1 comment
Open

Failed to copy files into a drive (C:, D:) on Windows #86

kimlimjustin opened this issue Jul 7, 2021 · 1 comment

Comments

@kimlimjustin
Copy link

kimlimjustin commented Jul 7, 2021

I tried cpy and it's awesome! However, when I try it on windows, copying a file from C: to the basedir of E:, I got an error saying it failed to create the E: directory. This is the error message:

Cannot copy from `C:/hello.txt` to `E:\hello.txt`: Cannot create directory `E:\`: EPERM: operation not permitted, mkdir 'E:\'

Hope it will be fixed soon :)

@kimlimjustin
Copy link
Author

kimlimjustin commented Jul 7, 2021

I looked into the code and I assume that is caused by this line of code:

cpy/index.js

Line 144 in 94fff3a

await cpFile(source.path, to, options).on('progress', fileProgressHandler);

and I noticed cpy use cp-file dependency, and I looked into the code and found this:

await fs.makeDir(path.dirname(destination), {mode: options.directoryMode});

which will create the directory (to ensure it exists) of the copy destination, which causes a bug in Windows drive basedir.

Hence, I think that this is the bug of cp-file, not cpy. However, I saw that there's already an issue with this bug since 2019, but not been fixed yet (not being maintained maybe)

sindresorhus/copy-file#36

kimlimjustin added a commit to kimlimjustin/xplorer that referenced this issue Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants