Skip to content

Commit

Permalink
fix: copyServeD if not installed or not up to date
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Feb 25, 2021
1 parent 7539693 commit f29aa32
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/installation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,18 @@ export async function isServeDUpToDate(file: string) {
return semverCompare(v1, targetVersion)
}

async function copyServeD(codeDBinFolder: string) {
atom.notifications.addInfo("Installing serve-d...")
// copy the whole served folder
await copy(bundledServerMap[process.platform], codeDBinFolder, { overwrite: true })
atom.notifications.addSuccess("Serve-d was installed")
}

export async function installServeD() {
const codeDBinFolder = await getCodeDBinFolder()
const serveDPath = join(codeDBinFolder, serveDExeFileName)
if (!(await isServeDInstalled(serveDPath))) {
atom.notifications.addInfo("Installing serve-d...")

// copy the whole served folder
await copy(bundledServerMap[process.platform], codeDBinFolder)

atom.notifications.addSuccess("Serve-d was installed")
if (!(await isServeDInstalled(serveDPath)) || !(await isServeDUpToDate(serveDPath))) {
await copyServeD(codeDBinFolder)
}
return serveDPath
}

0 comments on commit f29aa32

Please sign in to comment.