Skip to content

Commit 7bf1e69

Browse files
committed
fix: copyServeD if not installed or not up to date
1 parent 79d5581 commit 7bf1e69

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/installation.ts

+8-7
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,19 @@ export async function isServeDUpToDate(givenFile: string, targetFile: string) {
5252
return semverCompare(givenVersion, targetVersion) !== 0
5353
}
5454

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

5762
export async function installServeD() {
5863
const codeDBinFolder = await getCodeDBinFolder()
5964
const serveDPath = join(codeDBinFolder, serveDExeFileName)
60-
if (!(await isServeDInstalled(serveDPath))) {
61-
atom.notifications.addInfo("Installing serve-d...")
62-
63-
// copy the whole served folder
64-
await copy(bundledServerMap[process.platform], codeDBinFolder)
65-
66-
atom.notifications.addSuccess("Serve-d was installed")
65+
const bundledServeDPath = join(bundledServerMap[process.platform], serveDExeFileName)
66+
if (!(await isServeDInstalled(serveDPath)) || !(await isServeDUpToDate(serveDPath, bundledServeDPath))) {
67+
await copyServeD(codeDBinFolder)
6768
}
6869
return serveDPath
6970
}

0 commit comments

Comments
 (0)