IDEA-CR-63906 prefer findFileByNioFile, remove not applicable @SystemDependent annotation

GitOrigin-RevId: e7891758bd35a5733099500c3371f04a92b4f986
This commit is contained in:
Vladimir Krivosheev
2020-06-20 21:16:03 +03:00
committed by intellij-monorepo-bot
parent 433dbb4c66
commit d8ed48d6c5
@@ -145,18 +145,18 @@ public class JsonSchemaInfo {
return text;
}
Path ioFile = Paths.get(text);
if (!ioFile.isAbsolute()) {
Path file = Paths.get(text);
if (!file.isAbsolute()) {
return text;
}
String relativePath = FileUtil.getRelativePath(FileUtil.toSystemIndependentName(ioFile.toString()), project.getBasePath(), '/');
String relativePath = FileUtil.getRelativePath(FileUtil.toSystemIndependentName(file.toString()), project.getBasePath(), '/');
if (relativePath != null) {
return relativePath;
}
VirtualFile file = LocalFileSystem.getInstance().findFileByNioFile(ioFile);
if (file == null) {
VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByNioFile(file);
if (virtualFile == null) {
return text;
}
@@ -165,8 +165,8 @@ public class JsonSchemaInfo {
return text;
}
if (isMeaningfulAncestor(VfsUtilCore.getCommonAncestor(file, projectBaseDir))) {
String path = VfsUtilCore.findRelativePath(projectBaseDir, file, File.separatorChar);
if (isMeaningfulAncestor(VfsUtilCore.getCommonAncestor(virtualFile, projectBaseDir))) {
String path = VfsUtilCore.findRelativePath(projectBaseDir, virtualFile, File.separatorChar);
if (path != null) {
return path;
}