Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(datagrip) Strip .0 suffix from installation directory #2366

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion automatic/datagrip/tools/ChocolateyInstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ $toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$programFiles = (${env:ProgramFiles(x86)}, ${env:ProgramFiles} -ne $null)[0]
$pp = Get-PackageParameters

$installDir = "$programFiles\JetBrains\DataGrip $env:ChocolateyPackageVersion"
# If the release version ends in '.0', remove this since JetBrains don't
# use this part of the version number when creating the installation directory.
$installDir = "$programFiles\JetBrains\DataGrip $($env:ChocolateyPackageVersion -replace '.0$', '')"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're creating the directory further down on line 19. Can we not just remove that line and let the installer install wherever it thinks it should? Why do we need to create the directory?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well... originally I had assumed (possibly incorrectly) that the New-Item -ItemType Directory step in the original install script was required, but based on my own testing maybe it's not needed anymore? My quick searching seems to imply that it was part of a workaround for this older bug in the Jetbrains installer ( https://youtrack.jetbrains.com/issue/IDEA-202935 ) but it seems that since then the installer bug has been fixed, so this directory creation step might just be vestigial!

I can change the PR to remove the unnecessary cruft if you'd prefer?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The directory creation was indeed just because of a bug in the installer that would cause any custom directories used to fail the installation.

If this is now fixed, and works as expected, then I agree with @pauby that removing the manual creation of the directory instead of replacing it here.

To note though as well. IMO this wouldn't be the correct approach anyway, as if the directory does not respect the 3rd part of a version number if it is zero, we should not use the ChocolateyPackageVersion environment variable, but instead a hard-coded value we automatically insert when creating the package.

if ($pp.InstallDir) {
$installDir = $pp.InstallDir
}
Expand Down