get chocoPathVersion Correctly
This commit is contained in:
11
dist/index.js
vendored
11
dist/index.js
vendored
@@ -11078,7 +11078,12 @@ async function isInstalled(tool, version, os) {
|
|||||||
const ghcupPath = `${process.env.HOME}/.ghcup${tool === 'ghc' ? `/ghc/${version}` : ''}/bin`;
|
const ghcupPath = `${process.env.HOME}/.ghcup${tool === 'ghc' ? `/ghc/${version}` : ''}/bin`;
|
||||||
const v = tool === 'cabal' ? version.slice(0, 3) : version;
|
const v = tool === 'cabal' ? version.slice(0, 3) : version;
|
||||||
const aptPath = `/opt/${tool}/${v}/bin`;
|
const aptPath = `/opt/${tool}/${v}/bin`;
|
||||||
const chocoPath = path_1.join(`${process.env.ChocolateyInstall}`, 'lib', `${tool}.${version}`, 'tools', `${tool}-${version}`, tool === 'ghc' ? 'bin' : '');
|
const chocoPathArray = version.split('.');
|
||||||
|
const chocoPathVersion = chocoPathArray.length > 3
|
||||||
|
? chocoPathArray.slice(0, chocoPathArray.length - 1).join('.')
|
||||||
|
: chocoPathArray.join('.');
|
||||||
|
const chocoPath = path_1.join(`${process.env.ChocolateyInstall}`, 'lib', `${tool}.${version}`, 'tools', tool === 'ghc' ? `${tool}-${chocoPathVersion}` : `${tool}-${version}`, // choco trims the ghc version here
|
||||||
|
tool === 'ghc' ? 'bin' : '');
|
||||||
const locations = {
|
const locations = {
|
||||||
stack: [],
|
stack: [],
|
||||||
cabal: {
|
cabal: {
|
||||||
@@ -11184,8 +11189,8 @@ async function choco(tool, version) {
|
|||||||
ignoreReturnCode: true
|
ignoreReturnCode: true
|
||||||
});
|
});
|
||||||
// Manually add the path because it won't happen until the end of the step normally
|
// Manually add the path because it won't happen until the end of the step normally
|
||||||
let pathArray = version.split('.');
|
const pathArray = version.split('.');
|
||||||
let pathVersion = pathArray.length > 3
|
const pathVersion = pathArray.length > 3
|
||||||
? pathArray.slice(0, pathArray.length - 1).join('.')
|
? pathArray.slice(0, pathArray.length - 1).join('.')
|
||||||
: pathArray.join('.');
|
: pathArray.join('.');
|
||||||
const chocoPath = path_1.join(`${process.env.ChocolateyInstall}`, 'lib', `${tool}.${version}`, 'tools', tool === 'ghc' ? `${tool}-${pathVersion}` : `${tool}-${version}`, // choco trims the ghc version here
|
const chocoPath = path_1.join(`${process.env.ChocolateyInstall}`, 'lib', `${tool}.${version}`, 'tools', tool === 'ghc' ? `${tool}-${pathVersion}` : `${tool}-${version}`, // choco trims the ghc version here
|
||||||
|
|||||||
@@ -56,12 +56,17 @@ async function isInstalled(
|
|||||||
const v = tool === 'cabal' ? version.slice(0, 3) : version;
|
const v = tool === 'cabal' ? version.slice(0, 3) : version;
|
||||||
const aptPath = `/opt/${tool}/${v}/bin`;
|
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(
|
const chocoPath = join(
|
||||||
`${process.env.ChocolateyInstall}`,
|
`${process.env.ChocolateyInstall}`,
|
||||||
'lib',
|
'lib',
|
||||||
`${tool}.${version}`,
|
`${tool}.${version}`,
|
||||||
'tools',
|
'tools',
|
||||||
`${tool}-${version}`,
|
tool === 'ghc' ? `${tool}-${chocoPathVersion}` : `${tool}-${version}`, // choco trims the ghc version here
|
||||||
tool === 'ghc' ? 'bin' : ''
|
tool === 'ghc' ? 'bin' : ''
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user