mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
Remove the downloaded Git installer after using it, and in case of error: IDEA-221692
GitOrigin-RevId: fbb24f89686cff2f1875f3ddad46b0287ea4428c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
19cba95ae2
commit
996a2c1baf
@@ -29,16 +29,21 @@ class MacExecutableProblemHandler(val project: Project) : GitExecutableProblemHa
|
||||
private fun showGenericError(exception: Throwable, errorNotifier: ErrorNotifier, onErrorResolved: () -> Unit) {
|
||||
errorNotifier.showError("Git is not installed", ErrorNotifier.FixOption.Standard("Download and install") {
|
||||
errorNotifier.executeTask("Downloading...", false) {
|
||||
val installer = fetchInstaller(errorNotifier) { it.os == "macOS" }
|
||||
if (installer != null) {
|
||||
val fileName = installer.fileName
|
||||
val dmgFile = File(tempPath, fileName)
|
||||
val pkgFileName = installer.pkgFileName
|
||||
if (downloadGit(installer, dmgFile, project, errorNotifier)) {
|
||||
errorNotifier.changeProgressTitle("Installing...")
|
||||
installGit(dmgFile, pkgFileName, errorNotifier, onErrorResolved)
|
||||
try {
|
||||
val installer = fetchInstaller(errorNotifier) { it.os == "macOS" }
|
||||
if (installer != null) {
|
||||
val fileName = installer.fileName
|
||||
val dmgFile = File(tempPath, fileName)
|
||||
val pkgFileName = installer.pkgFileName
|
||||
if (downloadGit(installer, dmgFile, project, errorNotifier)) {
|
||||
errorNotifier.changeProgressTitle("Installing...")
|
||||
installGit(dmgFile, pkgFileName, errorNotifier, onErrorResolved)
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
FileUtil.delete(tempPath)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.intellij.openapi.application.PathManager
|
||||
import com.intellij.openapi.diagnostic.logger
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.SystemInfo
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import java.io.File
|
||||
|
||||
internal class WindowsExecutableProblemHandler(val project: Project) : GitExecutableProblemHandler {
|
||||
@@ -17,18 +18,23 @@ internal class WindowsExecutableProblemHandler(val project: Project) : GitExecut
|
||||
|
||||
override fun showError(exception: Throwable, errorNotifier: ErrorNotifier, onErrorResolved: () -> Unit) {
|
||||
errorNotifier.showError("Git is not installed", ErrorNotifier.FixOption.Standard("Download and install") {
|
||||
errorNotifier.executeTask("Downloading...", true) {
|
||||
val installer = fetchInstaller(errorNotifier) { it.os == "windows" && archMatches(it.arch) }
|
||||
if (installer != null) {
|
||||
val fileName = installer.fileName
|
||||
val exeFile = File(PathManager.getTempPath(), fileName)
|
||||
if (downloadGit(installer, exeFile, project, errorNotifier)) {
|
||||
errorNotifier.changeProgressTitle("Installing...")
|
||||
installGit(exeFile, errorNotifier, onErrorResolved)
|
||||
errorNotifier.executeTask("Downloading...", true) {
|
||||
val installer = fetchInstaller(errorNotifier) { it.os == "windows" && archMatches(it.arch) }
|
||||
if (installer != null) {
|
||||
val fileName = installer.fileName
|
||||
val exeFile = File(PathManager.getTempPath(), fileName)
|
||||
try {
|
||||
if (downloadGit(installer, exeFile, project, errorNotifier)) {
|
||||
errorNotifier.changeProgressTitle("Installing...")
|
||||
installGit(exeFile, errorNotifier, onErrorResolved)
|
||||
}
|
||||
}
|
||||
finally {
|
||||
FileUtil.delete(exeFile)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
private fun archMatches(arch: String) = if (SystemInfo.is32Bit) arch == "x86_32" else arch == "x86_64"
|
||||
|
||||
Reference in New Issue
Block a user