diff --git a/AndroidStudio/AndroidStudio.nuspec b/AndroidStudio/AndroidStudio.nuspec index 57ba6ad..4a2ed50 100644 --- a/AndroidStudio/AndroidStudio.nuspec +++ b/AndroidStudio/AndroidStudio.nuspec @@ -3,7 +3,7 @@ AndroidStudio Android Studio - 0.1.130.677228 + 0.2.130.737825 Google Ethan J Brown Android Studio is a new Android development environment based on IntelliJ IDEA. diff --git a/AndroidStudio/tools/chocolateyInstall.ps1 b/AndroidStudio/tools/chocolateyInstall.ps1 index 6c303a9..33d4e5a 100644 --- a/AndroidStudio/tools/chocolateyInstall.ps1 +++ b/AndroidStudio/tools/chocolateyInstall.ps1 @@ -1,15 +1,33 @@ $package = 'AndroidStudio' +$version = 130.737825 try { - $params = @{ - PackageName = $package; - FileType = 'exe'; - #uses NSIS installer - http://nsis.sourceforge.net/Docs/Chapter3.html - SilentArgs = '/S'; - Url = 'http://dl.google.com/android/studio/android-studio-bundle-130.677228-windows.exe'; - } - Install-ChocolateyPackage @params + $build = Join-Path $Env:LOCALAPPDATA 'Android\android-studio\build.txt' + + if ((Test-Path $build) -and ((Get-Content $build) -match '.*?(\d+\.\d+)')) + { + $installedVersion = [decimal]$Matches[1] + if ($installedVersion -lt $version) + { + Write-Host "Uninstalling existing version $installedVersion" + . .\chocolateyUninstall.ps1 + + $params = @{ + PackageName = $package; + FileType = 'exe'; + #uses NSIS installer - http://nsis.sourceforge.net/Docs/Chapter3.html + SilentArgs = '/S'; + Url = 'http://dl.google.com/android/studio/android-studio-bundle-130.737825-windows.exe'; + } + + Install-ChocolateyPackage @params + } + else + { + Write-Host "$package $installedVersion already installed!" + } + } Write-ChocolateySuccess $package } catch { diff --git a/AndroidStudio/tools/chocolateyUninstall.ps1 b/AndroidStudio/tools/chocolateyUninstall.ps1 index c115cd5..5108b5c 100644 --- a/AndroidStudio/tools/chocolateyUninstall.ps1 +++ b/AndroidStudio/tools/chocolateyUninstall.ps1 @@ -2,11 +2,6 @@ $package = 'AndroidStudio' try { - $installPath = (Join-Path "${Env:\ProgramFiles(x86)}" 'AndroidStudio'), - (Join-Path 'Env:ProgramFiles' 'AndroidStudio') | - ? { Test-Path $_ } | - Select -First 1 - $uninstall = Join-Path $Env:LOCALAPPDATA 'Android\android-studio\uninstall.exe' #uses NSIS installer - http://nsis.sourceforge.net/Docs/Chapter3.html