Skip to content

Commit

Permalink
Fix installation on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
hasufell committed Mar 2, 2022
1 parent 6a32c22 commit 86ba23c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/hlsBinaries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export async function downloadHaskellLanguageServer(
wrapper = downloadedWrapper;
}

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

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

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

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

0 comments on commit 86ba23c

Please sign in to comment.