Skip to content

Commit 86ba23c

Browse files
committed
Fix installation on windows
1 parent 6a32c22 commit 86ba23c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/hlsBinaries.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export async function downloadHaskellLanguageServer(
164164
wrapper = downloadedWrapper;
165165
}
166166

167-
const ghcup = path.join(storagePath, 'ghcup');
167+
const ghcup = path.join(storagePath, `ghcup${exeExt}`);
168168
const updateBehaviour = workspace.getConfiguration('haskell').get('updateBehavior') as UpdateBehaviour;
169169
const [installable_hls, latest_hls_version, project_ghc] = await getLatestSuitableHLS(
170170
context,
@@ -276,7 +276,7 @@ async function getLatestSuitableHLS(
276276
wrapper?: string
277277
): Promise<[string, string, string | null]> {
278278
const storagePath: string = await getStoragePath(context);
279-
const ghcup = path.join(storagePath, 'ghcup');
279+
const ghcup = path.join(storagePath, `ghcup${exeExt}`);
280280

281281
// get latest hls version
282282
const hls_versions = await callAsync(
@@ -294,7 +294,7 @@ async function getLatestSuitableHLS(
294294
// TODO: we may run this function twice on startup (e.g. in extension.ts)
295295
const project_ghc =
296296
wrapper == undefined
297-
? await callAsync('ghc', ['--numeric-version'], storagePath, logger, undefined, false)
297+
? await callAsync(`ghc${exeExt}`, ['--numeric-version'], storagePath, logger, undefined, false)
298298
: await getProjectGHCVersion(wrapper, workingDir, logger);
299299

300300
// get installable HLS that supports the project GHC version (this might not be the most recent)
@@ -371,9 +371,9 @@ export async function downloadGHCup(context: ExtensionContext, logger: Logger):
371371
fs.mkdirSync(storagePath);
372372
}
373373

374-
const ghcup = path.join(storagePath, 'ghcup');
374+
const ghcup = path.join(storagePath, `ghcup${exeExt}`);
375375
// ghcup exists, just upgrade
376-
if (fs.existsSync(path.join(storagePath, 'ghcup'))) {
376+
if (fs.existsSync(ghcup)) {
377377
const args = ['--no-verbose', 'upgrade', '-i'];
378378
await callAsync(ghcup, args, storagePath, logger, undefined, false, { GHCUP_INSTALL_BASE_PREFIX: storagePath });
379379
} else {
@@ -398,8 +398,8 @@ export async function downloadGHCup(context: ExtensionContext, logger: Logger):
398398
window.showErrorMessage(`Couldn't find any pre-built ghcup binary for ${process.arch}`);
399399
return null;
400400
}
401-
const title = 'Downloading ghcup';
402401
const dlUri = `https://downloads.haskell.org/~ghcup/${arch}-${plat}-ghcup${exeExt}`;
402+
const title = `Downloading ${dlUri}`;
403403
const downloaded = await downloadFile(title, dlUri, ghcup);
404404
if (!downloaded) {
405405
window.showErrorMessage(`Couldn't download ${dlUri} as ${ghcup}`);

0 commit comments

Comments
 (0)