[platform] symlinks in watch roots, test updated for OS X

This commit is contained in:
Roman Shevchenko
2015-10-28 11:47:39 +01:00
parent fe1786aefa
commit ff14a38a6f
2 changed files with 2 additions and 7 deletions
@@ -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);
@@ -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<Pair<String, String>> mappings = ContainerUtil.newArrayList();
mappings.add(pair(mappedDir.getPath(), realDir.getPath()));
pathMap.addMapping(mappings);
pathMap.addMapping(Collections.singletonList(pair(mappedDir.getPath(), realDir.getCanonicalPath())));
Collection<String> watchedPaths = pathMap.getWatchedPaths(new File(mappedDir, "file.txt").getPath(), true, false);
assertThat(watchedPaths).containsExactly(new File(symLink, "file.txt").getPath());