IDEA-136072 (fixed for Windows) appcode/140.2365
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>
Tue, 10 Feb 2015 19:35:44 +0000 (20:35 +0100)
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>
Tue, 10 Feb 2015 19:35:44 +0000 (20:35 +0100)
platform/util/src/com/intellij/openapi/application/PathManager.java
platform/util/testSrc/com/intellij/openapi/application/PathManagerTest.java

index c9b613dc37b6139ac337581dca29257eb9fc6e4e..86c01bbba103298e35c6ee95b74bd9ec824867f6 100644 (file)
  */
 package com.intellij.openapi.application;
 
-import com.intellij.openapi.util.NamedJDOMExternalizable;
-import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.util.SystemInfo;
-import com.intellij.openapi.util.SystemInfoRt;
+import com.intellij.openapi.util.*;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.util.io.URLUtil;
@@ -399,7 +396,8 @@ public class PathManager {
         value = "";
       }
 
-      s = m.replaceAll(value);
+      s = StringUtil.replace(s, m.group(), value);
+      m = PROPERTY_REF.matcher(s);
     }
 
     return s;
index c7deac22a25e5438d4a5679b3a8054ea021c8e70..f8245c7c3b93a37e518adad25b2e7f11f9e7967c 100644 (file)
@@ -48,9 +48,10 @@ public class PathManagerTest {
 
     String home = System.clearProperty(PathManager.PROPERTY_HOME_PATH);
     try {
-      assertEquals(PathManager.getHomePath() + "/build.txt", PathManager.substituteVars("${idea.home.path}/build.txt"));
       assertEquals(PathManager.getHomePath() + "/build.txt", PathManager.substituteVars("${idea.home}/build.txt"));
-      assertEquals("/opt/idea/build.txt", PathManager.substituteVars("${idea.home.path}/build.txt", "/opt/idea"));
+      assertEquals(PathManager.getHomePath() + "\\build.txt", PathManager.substituteVars("${idea.home.path}\\build.txt"));
+      assertEquals("/opt/idea/build.txt", PathManager.substituteVars("${idea.home}/build.txt", "/opt/idea"));
+      assertEquals("C:\\opt\\idea\\build.txt", PathManager.substituteVars("${idea.home.path}\\build.txt", "C:\\opt\\idea"));
     }
     finally {
       if (home != null) {