URL (VirtualFile file) { if (file.getFileSystem() instanceof JarFileSystem && file.getParent() != null) return null; String path = file.getPath(); if (path.endsWith(JarFileSystem.JAR_SEPARATOR)) { path = path.substring(0, path.length() - 2); } String url; if (SystemInfo.isWindows) { url = "file:/" + path; } else { url = "file://" + path; } if (file.isDirectory() && !(file.getFileSystem() instanceof JarFileSystem)) url += "/"; try { return new URL(url); } catch (MalformedURLException e) { LOG.error(e); return null; } }