call path.basename w/ extension name to avoid e.g. `.js.1.js`

This commit is contained in:
Michael Bradley, Jr 2018-10-03 14:54:53 -05:00
parent c8640da7d6
commit f94d3a1263
1 changed files with 2 additions and 1 deletions

View File

@ -120,9 +120,10 @@ function copyPreserve(sourceFilePath, targetFilePath) {
let ext = 1; let ext = 1;
let preserved = targetFilePath; let preserved = targetFilePath;
while (fs.existsSync(preserved)) { while (fs.existsSync(preserved)) {
let extname = path.extname(targetFilePath);
preserved = utils.joinPath( preserved = utils.joinPath(
path.dirname(targetFilePath), path.dirname(targetFilePath),
`${path.basename(targetFilePath)}.${ext}${path.extname(targetFilePath)}` `${path.basename(targetFilePath, extname)}.${ext}${extname}`
); );
ext++; ext++;
} }