mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 19:02:13 +07:00
platform: normalize descriptor paths to find paths starting with './'
That will sync behavior of IDE started from sources (where descriptors are loaded from files) and built IDE (where descriptors are loaded from jar files). Also, that will allow to specify paths uniformly in `xi:include` and `depends`, e.g. <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="./jest.xml" xpointer="xpointer(/idea-plugin/*)"/> <depends optional="true" config-file="./jest-coverage.xml">com.intellij.modules.coverage</depends>
This commit is contained in:
@@ -57,10 +57,7 @@ import org.jetbrains.annotations.TestOnly;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
@@ -680,7 +677,7 @@ public class PluginManagerCore {
|
||||
@NotNull JDOMXIncluder.PathResolver pathResolver,
|
||||
@NotNull LoadingContext context) {
|
||||
try {
|
||||
URL jarURL = URLUtil.getJarEntryURL(file, META_INF + '/' + fileName);
|
||||
URL jarURL = URLUtil.getJarEntryURL(file, getNormalizedPathInJar(fileName));
|
||||
|
||||
ZipFile zipFile = context.myOpenedFiles.get(file);
|
||||
if (zipFile == null) {
|
||||
@@ -707,6 +704,17 @@ public class PluginManagerCore {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String getNormalizedPathInJar(@NotNull String pathInJar) {
|
||||
String absolutePathInJar = META_INF + '/' + pathInJar;
|
||||
try {
|
||||
return new URI(absolutePathInJar).normalize().getPath();
|
||||
}
|
||||
catch (URISyntaxException ignored) {
|
||||
}
|
||||
return absolutePathInJar;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static IdeaPluginDescriptorImpl loadDescriptor(@NotNull final File file, @NotNull String fileName) {
|
||||
try (LoadingContext context = new LoadingContext()) {
|
||||
|
||||
Reference in New Issue
Block a user