From a153b5cf704e3ba524f6899095ddc65266609929 Mon Sep 17 00:00:00 2001 From: Mickael Istria Date: Tue, 7 Jun 2022 23:46:42 +0200 Subject: [PATCH] Fix loading of local resources Fixes https://github.com/eclipse/tm4e/issues/409 --- .../java/org/eclipse/tm4e/registry/TMResource.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/org.eclipse.tm4e.registry/src/main/java/org/eclipse/tm4e/registry/TMResource.java b/org.eclipse.tm4e.registry/src/main/java/org/eclipse/tm4e/registry/TMResource.java index cba28c02c..02c24dc9d 100644 --- a/org.eclipse.tm4e.registry/src/main/java/org/eclipse/tm4e/registry/TMResource.java +++ b/org.eclipse.tm4e.registry/src/main/java/org/eclipse/tm4e/registry/TMResource.java @@ -19,10 +19,9 @@ import java.util.Scanner; import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.Platform; import org.eclipse.jdt.annotation.Nullable; -import com.google.common.base.Strings; - /** * TextMate Resource. */ @@ -76,14 +75,9 @@ public String getPluginId() { @Nullable @Override public InputStream getInputStream() throws IOException { - if (Strings.isNullOrEmpty(path)) { - return null; - } - if (!Strings.isNullOrEmpty(path)) { - final URL url = new URL(PLATFORM_PLUGIN + pluginId + "/" + path); - return url.openStream(); - } - return new FileInputStream(new File(path)); + return pluginId != null ? + Platform.getBundle(pluginId).getResource(path).openStream() : // + new FileInputStream(new File(path)); } @Nullable