ability to get mock fs root — findFileByPath("") must returns root

This commit is contained in:
Vladimir Krivosheev
2014-09-10 02:50:19 +02:00
parent d5c076eee3
commit 32cc383e7a
@@ -36,9 +36,8 @@ public class MockVirtualFileSystem extends DeprecatedVirtualFileSystem {
path = path.replace(File.separatorChar, '/');
path = path.replace('/', ':');
if (StringUtil.startsWithChar(path, ':')) path = path.substring(1);
String[] components = path.split(":");
MyVirtualFile file = myRoot;
for (String component : components) {
for (String component : StringUtil.split(path, ":")) {
file = file.getOrCreate(component);
}
return file;