Skip to content

Commit

Permalink
Fix loading of local resources
Browse files Browse the repository at this point in the history
Fixes #409
  • Loading branch information
mickaelistria committed Jun 7, 2022
1 parent 1f169c3 commit a153b5c
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a153b5c

Please sign in to comment.