in ideaSupport/src/main/scala/org/jetbrains/sbtidea/download/plugin/RepoPluginInstaller.scala [17:44]
override def isInstalled(art: RemotePluginArtifact)(implicit ctx: IdeInstallationContext): Boolean =
!IdeaUpdater.isDumbPlugins &&
localRegistry.isPluginInstalled(art.caller.plugin) &&
isInstalledPluginUpToDate(art.caller.plugin)
override def downloadAndInstall(art: RemotePluginArtifact)(implicit ctx: IdeInstallationProcessContext): Unit = {
val downloader = FileDownloader(ctx)
val downloadUrl = art.dlUrl
val (downloadedDir, usedDownloadUrl) = try {
(downloader.download(downloadUrl), downloadUrl)
} catch {
case de: DownloadException if de.responseCode.contains(NotFoundHttpResponseCode) =>
art.caller.plugin.fallbackDownloadUrl match {
case Some(fallbackUrl) =>
log.warn(s"Plugin not found at $downloadUrl\nTrying to download from a fallback url $fallbackUrl")
(downloader.download(fallbackUrl), fallbackUrl)
case _ =>
throw de
}
}
// Get the file name from the downloaded artifact
val downloadedPluginFileName = downloadedDir.getFileName.toString
val currentTime = LocalDateTime.now()
val downloadInfo = PluginDownloadInfo(downloadedPluginFileName, usedDownloadUrl, currentTime)
installIdeaPlugin(art.caller.plugin, downloadedDir, Some(downloadInfo))
}