WEB-13295 Incorrect files downloaded for ZURB Foundation projects, on phpStorm 7...
authorSergey Simonchik <sergey.simonchik@jetbrains.com>
Thu, 23 Oct 2014 08:17:52 +0000 (12:17 +0400)
committerSergey Simonchik <sergey.simonchik@jetbrains.com>
Thu, 23 Oct 2014 08:17:52 +0000 (12:17 +0400)
platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/AbstractGithubTagDownloadedProjectGenerator.java

index 09bca34d2a24301d4f51391638d36f89d0f1b2d3..6ab678bf722c0c9283c89da166ed60afcd24a620 100644 (file)
@@ -89,34 +89,22 @@ public abstract class AbstractGithubTagDownloadedProjectGenerator extends WebPro
                            @NotNull File extractToDir,
                            @NotNull GithubTagInfo tag) throws GeneratorException {
     File zipArchiveFile = getCacheFile(tag);
-    boolean brokenZip = true;
-    boolean unitTestMode = ApplicationManager.getApplication().isUnitTestMode();
-    if (!unitTestMode && zipArchiveFile.isFile()) {
+    String primaryUrl = getPrimaryZipArchiveUrlForDownload(tag);
+    boolean downloaded = false;
+    if (primaryUrl != null) {
       try {
-        ZipUtil.unzipWithProgressSynchronously(project, getTitle(), zipArchiveFile, extractToDir, true);
-        brokenZip = false;
-      }
-      catch (GeneratorException ignored) {
+        downloadAndUnzip(project, primaryUrl, zipArchiveFile, extractToDir, false);
+        downloaded = true;
+      } catch (GeneratorException e) {
+        LOG.info("Can't download " + primaryUrl, e);
+        FileUtil.delete(zipArchiveFile);
       }
     }
-    if (brokenZip) {
-      String primaryUrl = getPrimaryZipArchiveUrlForDownload(tag);
-      boolean downloaded = false;
-      if (primaryUrl != null) {
-        try {
-          downloadAndUnzip(project, primaryUrl, zipArchiveFile, extractToDir, false);
-          downloaded = true;
-        } catch (GeneratorException e) {
-          LOG.info("Can't download " + primaryUrl, e);
-          FileUtil.delete(zipArchiveFile);
-        }
-      }
-      if (!downloaded) {
-        if (unitTestMode) {
-          throw new GeneratorException("Download " + tag.getZipballUrl() + " is skipped in unit test mode");
-        }
-        downloadAndUnzip(project, tag.getZipballUrl(), zipArchiveFile, extractToDir, true);
+    if (!downloaded) {
+      if (ApplicationManager.getApplication().isUnitTestMode()) {
+        throw new GeneratorException("Download " + tag.getZipballUrl() + " is skipped in unit test mode");
       }
+      downloadAndUnzip(project, tag.getZipballUrl(), zipArchiveFile, extractToDir, true);
     }
   }