Skip to content

Commit

Permalink
fix: hotspot detection uses correct build directories
Browse files Browse the repository at this point in the history
  • Loading branch information
goerlibe committed Dec 14, 2023
1 parent afa7136 commit 064acfd
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions src/HotspotDetection/HotspotDetectionRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,25 @@ export abstract class HotspotDetectionRunner {
message: 'Preparing build directory...',
increment: 5,
operation: async () => {
if (fs.existsSync(args.buildPath)) {
// remove everything but the .discopop directory from the build directory
const files = fs.readdirSync(args.buildPath)
for (const file of files) {
if (file !== '.discopop') {
fs.rmSync(`${args.buildPath}/${file}`, {
recursive: true,
})
}
}
if (!fs.existsSync(args.buildPath)) {
fs.mkdirSync(args.buildPath, {
recursive: true,
})
} else if (
Config.skipOverwriteConfirmation() ||
(await UIPrompts.actionConfirmed(
'The build directory already exists. Do you want to overwrite it?\n(You can disable this dialog in the extension settings)'
))
) {
fs.rmSync(args.buildPath, {
recursive: true,
})
fs.mkdirSync(args.buildPath, {
recursive: true,
})
} else {
throw new Error('Operation cancelled by user')
}
fs.mkdirSync(args.buildPath, {
recursive: true,
})
},
})

Expand Down

0 comments on commit 064acfd

Please sign in to comment.