Skip to content
Permalink
Browse files

fix(cli): copy 文件时,源文件与目标位置相同时报错

  • Loading branch information...
luckyadam committed Jan 28, 2019
1 parent fe9fdca commit 3a9cbe8bbe90cc5935fb4ec7640ec22e4d1f9044
Showing with 9 additions and 0 deletions.
  1. +9 −0 packages/taro-cli/src/weapp.js
@@ -941,6 +941,9 @@ function copyFilesFromSrcToOutput (files) {
Util.printLog(Util.pocessTypeEnum.ERROR, '文件', `${modifySrc} 不存在`)
} else {
fs.ensureDir(path.dirname(outputFilePath))
if (file === outputFilePath) {
return
}
fs.copySync(file, outputFilePath)
}
})
@@ -1970,8 +1973,14 @@ function copyFileSync (from, to, options) {
const filename = path.basename(from)
if (fs.statSync(from).isFile() && !path.extname(to)) {
fs.ensureDir(to)
if (from === path.join(to, filename)) {
return
}
return fs.copySync(from, path.join(to, filename), options)
}
if (from === to) {
return
}
fs.ensureDir(path.dirname(to))
return fs.copySync(from, to, options)
}

0 comments on commit 3a9cbe8

Please sign in to comment.
You can’t perform that action at this time.