fix macro replacements: skip relative paths to root to not walk relatively under root dir

This commit is contained in:
Alexey Pegov
2009-10-22 19:34:44 +04:00
parent d35a4b83e3
commit 16b2124e70
2 changed files with 2 additions and 4 deletions
@@ -86,12 +86,11 @@ public class ModulePathMacroManager extends BasePathMacroManager /*ProjectPathMa
String macro = "$" + PathMacrosImpl.MODULE_DIR_MACRO_NAME + "$";
boolean check = false;
while (f != null) {
while (f != null && f.getParentFile() != null) {
@NonNls String path = PathMacroMap.quotePath(f.getAbsolutePath());
String s = macro;
if (StringUtil.endsWithChar(path, '/')) s += "/";
if (path.equals("/")) break;
putIfAbsent(result, "file://" + path, "file://" + s, check);
putIfAbsent(result, "file:/" + path, "file:/" + s, check);
@@ -57,12 +57,11 @@ public class ProjectPathMacroManager extends BasePathMacroManager {
String macro = "$" + PathMacrosImpl.PROJECT_DIR_MACRO_NAME + "$";
boolean check = false;
while (f != null) {
while (f != null && f.getParentFile() != null) {
String path = PathMacroMap.quotePath(f.getAbsolutePath());
String s = macro;
if (StringUtil.endsWithChar(path, '/')) s += "/";
if (path.equals("/")) break;
putIfAbsent(result, "file://" + path, "file://" + s, check);
putIfAbsent(result, "file:/" + path, "file:/" + s, check);