add getInstance for JrtFileSystem

GitOrigin-RevId: bdfcda4885a755628f804d0a4180eec0eaba33d3
This commit is contained in:
Eugene Petrenko
2020-10-13 18:58:40 +00:00
committed by intellij-monorepo-bot
parent 024d211d18
commit 9d702fa6b2
@@ -1,7 +1,8 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.vfs.jrt;
import com.intellij.openapi.vfs.StandardFileSystems;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.openapi.vfs.VirtualFilePointerCapableFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.newvfs.ArchiveFileSystem;
@@ -13,6 +14,10 @@ public abstract class JrtFileSystem extends ArchiveFileSystem implements Virtual
public static final String PROTOCOL_PREFIX = StandardFileSystems.JRT_PROTOCOL_PREFIX;
public static final String SEPARATOR = URLUtil.JAR_SEPARATOR;
public static JrtFileSystem getInstance() {
return (JrtFileSystem)VirtualFileManager.getInstance().getFileSystem(PROTOCOL);
}
public static boolean isRoot(@NotNull VirtualFile file) {
return file.getParent() == null && file.getFileSystem() instanceof JrtFileSystem;
}