Skip to content

Commit

Permalink
Fix for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
szwacz committed Jul 14, 2020
1 parent 849c3e4 commit db47c56
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/move.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ const moveSync = (from, to, options) => {
try {
fs.renameSync(from, to);
} catch (err) {
if (err.code === "EISDIR" && opts.overwrite === true) {
if (
(err.code === "EISDIR" || err.code === "EPERM") &&
opts.overwrite === true
) {
// Looks like the destination path is a directory,
// and we have permission for overwriting, so can remove it.
remove.sync(to);
Expand Down Expand Up @@ -104,7 +107,10 @@ const moveAsync = (from, to, options) => {
fs.rename(from, to)
.then(resolve)
.catch(err => {
if (err.code === "EISDIR" && opts.overwrite === true) {
if (
(err.code === "EISDIR" || err.code === "EPERM") &&
opts.overwrite === true
) {
// Looks like the destination path is a directory,
// and we have permission for overwriting, so can remove it.
remove
Expand Down

0 comments on commit db47c56

Please sign in to comment.