fix: If you can't rename, copy

This commit is contained in:
Felix Rieseberg 2020-07-29 12:05:14 -07:00
parent 9cd62be64d
commit e5c008887b

View File

@ -36,7 +36,12 @@ function getUserDataDiskImage() {
// If there's a disk image, move it over
if (!fs.existsSync(diskImageUserPath)) {
fs.renameSync(diskImagePath, diskImageUserPath);
try {
fs.renameSync(diskImagePath, diskImageUserPath);
} catch (error) {
// This is _probably_ a permissions thing, let's copy the file
fs.copyFileSync(diskImagePath, diskImageUserPath);
}
} else {
console.log(
`getUserDataDiskImage: Image in user data dir, not doing anything`