Merge remote-tracking branch 'origin/master' phpstorm/134.1377
authorVladimir Orlov <vladimir.orlov@jetbrains.com>
Sat, 1 Mar 2014 08:57:18 +0000 (12:57 +0400)
committerVladimir Orlov <vladimir.orlov@jetbrains.com>
Sat, 1 Mar 2014 08:57:18 +0000 (12:57 +0400)
platform/bootstrap/src/com/intellij/idea/Main.java
updater/src/com/intellij/updater/Runner.java
updater/testSrc/com/intellij/updater/DigesterTest.java
updater/testSrc/com/intellij/updater/RunnerTest.java
updater/testSrc/com/intellij/updater/UpdaterTestCase.java

index 33a95c5bbc7521ee44f6125acae7adac122f7102..2e11ce3e9b3d8fa30c8a3b2b7817741fba2e27d4 100644 (file)
@@ -155,10 +155,10 @@ public class Main {
                          "-classpath",
                          copyPatchFile.getPath() + File.pathSeparator + PathManager.getLibPath() + "/log4j.jar",
                          "-Djava.io.tmpdir=" + tempDir,
+                         "-Didea.updater.log=" + PathManager.getLogPath(),
                          "com.intellij.updater.Runner",
                          "install",
-                         PathManager.getHomePath(),
-                         PathManager.getLogPath());
+                         PathManager.getHomePath());
 
       status = Restarter.scheduleRestart(ArrayUtilRt.toStringArray(args));
     }
index 966a4a05896affdfffba45961e81c1c5ae8a6239..8148d49c221ad50a2763b71dfd0b091e714eacd4 100644 (file)
@@ -31,8 +31,9 @@ public class Runner {
       String newFolder = args[4];
       String patchFile = args[5];
 
-      String logFolder = args[6];
-      initLogger(logFolder);
+//      String logFolder = args[6];
+//      initLogger(logFolder);
+      initLogger();
 
       List<String> ignoredFiles = extractFiles(args, "ignored");
       List<String> criticalFiles = extractFiles(args, "critical");
@@ -42,8 +43,9 @@ public class Runner {
     else if (args.length >= 2 && "install".equals(args[0])) {
       String destFolder = args[1];
 
-      String logFolder = args.length >= 3 ? args[2] : null;
-      initLogger(logFolder);
+//      String logFolder = args.length >= 3 ? args[2] : null;
+//      initLogger(logFolder);
+      initLogger();
       logger.info("destFolder: " + destFolder);
 
       install(destFolder);
@@ -59,7 +61,9 @@ public class Runner {
     return fileLogDir.isDirectory() && fileLogDir.canWrite() && fileLogDir.getUsableSpace() >= 1000000;
   }
 
-  private static String getLogDir(String logFolder) {
+//  private static String getLogDir(String logFolder) {
+  private static String getLogDir() {
+    String logFolder = System.getProperty("idea.updater.log");
     if (logFolder == null || !isValidLogDir(logFolder)) {
       logFolder = System.getProperty("java.io.tmpdir");
       if (!isValidLogDir(logFolder)) {
@@ -69,9 +73,13 @@ public class Runner {
     return logFolder;
   }
 
-  public static void initLogger(String logFolder) {
+//  public static void initLogger(String logFolder) {
+  public static void initLogger() {
     if (logger == null) {
-      logFolder = getLogDir(logFolder);
+//      String logFolder = System.getProperty("idea.updater.log");
+//      String logFolder = getLogDir(System.getProperty("idea.updater.log"));
+      String logFolder = getLogDir();
+      System.out.println("Log dir: " + logFolder);
       FileAppender update = new FileAppender();
 
       update.setFile(new File(logFolder, "idea_updater.log").getAbsolutePath());
index a7ec965359ee9ee7b72b48d055511f2cba60b603..a2ca3005cf5a7fb5ebc55907411e9db7aff01d3d 100644 (file)
@@ -10,12 +10,13 @@ import static org.junit.Assert.assertEquals;
 public class DigesterTest extends UpdaterTestCase {
   @Test
   public void testBasics() throws Exception {
+//    Runner.initLogger(System.getProperty("java.io.tmpdir"));
+    Runner.initLogger();
     Map<String, Long> checkSums = Digester.digestFiles(getDataDir(), Collections.<String>emptyList(), TEST_UI);
     assertEquals(12, checkSums.size());
 
     assertEquals(CHECKSUMS.README_TXT, (long)checkSums.get("Readme.txt"));
     assertEquals(CHECKSUMS.FOCUSKILLER_DLL, (long)checkSums.get("bin/focuskiller.dll"));
     assertEquals(CHECKSUMS.BOOTSTRAP_JAR, (long)checkSums.get("lib/bootstrap.jar"));
-    Runner.initLogger(System.getProperty("java.io.tmpdir"));
   }
 }
\ No newline at end of file
index 4813db1711b32d6375593b00c28452317a2fb5fb..7ac850139a3e2e5fd6582f23014fa16c1cbaefd3 100644 (file)
@@ -11,7 +11,8 @@ public class RunnerTest extends UpdaterTestCase {
   @Test
   public void testExtractingFiles() throws Exception {
     String[] args = {"bar", "ignored=xxx;yyy;zzz/zzz", "critical=", "ignored=aaa", "baz", "critical=ccc"};
-    Runner.initLogger(System.getProperty("java.io.tmpdir"));
+//    Runner.initLogger(System.getProperty("java.io.tmpdir"));
+    Runner.initLogger();
 
     assertEquals(Arrays.asList("xxx", "yyy", "zzz/zzz", "aaa"),
                  Runner.extractFiles(args, "ignored"));
index 82d7bbe860c720fd67a1e9ec5637b547016c1f97..9d3b5804d2d2203b59e2174e7b243efd23af7e9b 100644 (file)
@@ -25,7 +25,8 @@ public abstract class UpdaterTestCase {
 
   @Before
   public void setUp() throws Exception {
-    Runner.initLogger(System.getProperty("java.io.tmpdir"));
+//    Runner.initLogger(System.getProperty("java.io.tmpdir"));
+    Runner.initLogger();
     myTempDirFixture = IdeaTestFixtureFactory.getFixtureFactory().createTempDirTestFixture();
     myTempDirFixture.setUp();