Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 0ab446a

Browse files
committed
get chocoPathVersion Correctly
1 parent 4cd1e34 commit 0ab446a

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

dist/index.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11078,7 +11078,12 @@ async function isInstalled(tool, version, os) {
1107811078
const ghcupPath = `${process.env.HOME}/.ghcup${tool === 'ghc' ? `/ghc/${version}` : ''}/bin`;
1107911079
const v = tool === 'cabal' ? version.slice(0, 3) : version;
1108011080
const aptPath = `/opt/${tool}/${v}/bin`;
11081-
const chocoPath = path_1.join(`${process.env.ChocolateyInstall}`, 'lib', `${tool}.${version}`, 'tools', `${tool}-${version}`, tool === 'ghc' ? 'bin' : '');
11081+
const chocoPathArray = version.split('.');
11082+
const chocoPathVersion = chocoPathArray.length > 3
11083+
? chocoPathArray.slice(0, chocoPathArray.length - 1).join('.')
11084+
: chocoPathArray.join('.');
11085+
const chocoPath = path_1.join(`${process.env.ChocolateyInstall}`, 'lib', `${tool}.${version}`, 'tools', tool === 'ghc' ? `${tool}-${chocoPathVersion}` : `${tool}-${version}`, // choco trims the ghc version here
11086+
tool === 'ghc' ? 'bin' : '');
1108211087
const locations = {
1108311088
stack: [],
1108411089
cabal: {
@@ -11184,8 +11189,8 @@ async function choco(tool, version) {
1118411189
ignoreReturnCode: true
1118511190
});
1118611191
// Manually add the path because it won't happen until the end of the step normally
11187-
let pathArray = version.split('.');
11188-
let pathVersion = pathArray.length > 3
11192+
const pathArray = version.split('.');
11193+
const pathVersion = pathArray.length > 3
1118911194
? pathArray.slice(0, pathArray.length - 1).join('.')
1119011195
: pathArray.join('.');
1119111196
const chocoPath = path_1.join(`${process.env.ChocolateyInstall}`, 'lib', `${tool}.${version}`, 'tools', tool === 'ghc' ? `${tool}-${pathVersion}` : `${tool}-${version}`, // choco trims the ghc version here

src/installer.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,17 @@ async function isInstalled(
5656
const v = tool === 'cabal' ? version.slice(0, 3) : version;
5757
const aptPath = `/opt/${tool}/${v}/bin`;
5858

59+
const chocoPathArray = version.split('.');
60+
const chocoPathVersion =
61+
chocoPathArray.length > 3
62+
? chocoPathArray.slice(0, chocoPathArray.length - 1).join('.')
63+
: chocoPathArray.join('.');
5964
const chocoPath = join(
6065
`${process.env.ChocolateyInstall}`,
6166
'lib',
6267
`${tool}.${version}`,
6368
'tools',
64-
`${tool}-${version}`,
69+
tool === 'ghc' ? `${tool}-${chocoPathVersion}` : `${tool}-${version}`, // choco trims the ghc version here
6570
tool === 'ghc' ? 'bin' : ''
6671
);
6772

0 commit comments

Comments
 (0)