[java] fixes JRT file system refresh on Windows

This commit is contained in:
Roman Shevchenko
2016-02-08 19:30:40 +01:00
parent e202141517
commit c5bbe4a7cd
2 changed files with 5 additions and 2 deletions
@@ -111,7 +111,7 @@ public class JrtFileSystem extends ArchiveFileSystem {
protected ArchiveHandler getHandler(@NotNull VirtualFile entryFile) {
checkSubscription();
String homePath = extractLocalPath(extractRootPath(entryFile.getPath()));
String homePath = FileUtil.toSystemIndependentName(extractLocalPath(extractRootPath(entryFile.getPath())));
ArchiveHandler handler = myHandlers.get(homePath);
if (handler == null) {
handler = isSupported() ? new JrtHandler(homePath) : new JrtHandlerStub(homePath);
@@ -86,7 +86,10 @@ public class JrtFileSystemTest extends BareTestFixtureTestCase {
assertThat(Stream.of(dir.getChildren()).map(VirtualFile::getName).collect(Collectors.toList())).containsOnly("pkg1");
assertThat(myRoot.findFileByRelativePath("test/pkg2/Class2.class")).isNull();
Files.copy(myTestData.resolve("image2"), myTempDir.getRoot().toPath().resolve("lib/modules"), StandardCopyOption.REPLACE_EXISTING);
Path modules = myTempDir.getRoot().toPath().resolve("lib/modules");
Files.move(modules, myTempDir.getRoot().toPath().resolve("lib/modules.bak"));
Files.copy(myTestData.resolve("image2"), modules, StandardCopyOption.REPLACE_EXISTING);
VirtualFile local = LocalFileSystem.getInstance().findFileByIoFile(myTempDir.getRoot());
assertThat(local).isNotNull();
local.refresh(false, true);