diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/CanonicalPathMap.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/CanonicalPathMap.java index 77621baedd82..29914afe9ebc 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/CanonicalPathMap.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/CanonicalPathMap.java @@ -163,7 +163,7 @@ class CanonicalPathMap { for (int i = 0; i < pathComponents.size(); ++i) { String currentPathComponent = pathComponents.get(i); if (runningPath == null) { - runningPath = new File(currentPathComponent); + runningPath = new File(currentPathComponent.isEmpty() ? "/" : currentPathComponent); } else { runningPath = new File(runningPath, currentPathComponent); diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/local/CanonicalPathMapTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/local/CanonicalPathMapTest.java index ca91bfd671aa..002bc48b351b 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/local/CanonicalPathMapTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/local/CanonicalPathMapTest.java @@ -15,9 +15,7 @@ */ package com.intellij.openapi.vfs.impl.local; -import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.io.IoTestUtil; -import com.intellij.util.containers.ContainerUtil; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; @@ -25,7 +23,6 @@ import org.junit.rules.TemporaryFolder; import java.io.File; import java.util.Collection; import java.util.Collections; -import java.util.List; import static com.intellij.openapi.util.Pair.pair; import static org.assertj.core.api.Assertions.assertThat; @@ -44,9 +41,7 @@ public class CanonicalPathMapTest { CanonicalPathMap pathMap = new CanonicalPathMap(Collections.singletonList(symLink.getPath()), Collections.emptyList()); // REMAP from native file watcher: /?/root/mapped -> /?/root/real - List> mappings = ContainerUtil.newArrayList(); - mappings.add(pair(mappedDir.getPath(), realDir.getPath())); - pathMap.addMapping(mappings); + pathMap.addMapping(Collections.singletonList(pair(mappedDir.getPath(), realDir.getCanonicalPath()))); Collection watchedPaths = pathMap.getWatchedPaths(new File(mappedDir, "file.txt").getPath(), true, false); assertThat(watchedPaths).containsExactly(new File(symLink, "file.txt").getPath());