get chocoPathVersion Correctly

This commit is contained in:
Thomas Boop
2020-11-16 11:23:35 -05:00
parent 4cd1e346a4
commit 0ab446a68d
2 changed files with 14 additions and 4 deletions

View File

@@ -56,12 +56,17 @@ async function isInstalled(
const v = tool === 'cabal' ? version.slice(0, 3) : version;
const aptPath = `/opt/${tool}/${v}/bin`;
const chocoPathArray = version.split('.');
const chocoPathVersion =
chocoPathArray.length > 3
? chocoPathArray.slice(0, chocoPathArray.length - 1).join('.')
: chocoPathArray.join('.');
const chocoPath = join(
`${process.env.ChocolateyInstall}`,
'lib',
`${tool}.${version}`,
'tools',
`${tool}-${version}`,
tool === 'ghc' ? `${tool}-${chocoPathVersion}` : `${tool}-${version}`, // choco trims the ghc version here
tool === 'ghc' ? 'bin' : ''
);