Skip to content

Commit

Permalink
Create fails when /tmp is on a different filesystem than /home #19
Browse files Browse the repository at this point in the history
Signed-off-by: macdonst <simon.macdonald@gmail.com>
  • Loading branch information
macdonst committed Oct 11, 2023
1 parent 9e8a485 commit 25b99b2
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions create-project.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,9 @@ export async function createProject ({ dest, path, name }) {
tar.x({ C: temp, file: starterProjectArchive, sync: true })

// Move starter project to final destination

// Check if the temp and projectDir are on the same file system
const tempRoot = parse(temp).root
const projectRoot = parse(projectDir).root
const isSameFileSystemRoot = tempRoot === projectRoot
const packageDir = join(temp, 'package')

if (!isSameFileSystemRoot) {
// if not, we need to copy the files instead of moving them
copySync(packageDir, projectDir)
rmSync(packageDir, { recursive: true })
} else {
renameSync(packageDir, projectDir)
}
copySync(packageDir, projectDir)
rmSync(packageDir, { recursive: true })

// Clean up download
unlinkSync(starterProjectArchive)
Expand Down

0 comments on commit 25b99b2

Please sign in to comment.