--- /dev/null
+package org.simantics.g3d.tools;\r
+\r
+import java.io.File;\r
+import java.net.URL;\r
+\r
+import org.eclipse.core.runtime.FileLocator;\r
+import org.eclipse.core.runtime.IPath;\r
+import org.eclipse.core.runtime.Path;\r
+import org.osgi.framework.Bundle;\r
+\r
+public class PluginTools {\r
+ \r
+ public static String getAbsolutePath(Bundle inBundle, String fullpath) {\r
+ IPath path = new Path(fullpath);\r
+ URL u = FileLocator.find(inBundle, path, null);\r
+ if (u != null) {\r
+ try {\r
+ u = FileLocator.resolve(u);\r
+ if ("file".equals(u.getProtocol())) {\r
+ return new File(u.getFile()).getAbsolutePath();\r
+ }\r
+ } catch (Exception e) {\r
+ }\r
+ }\r
+ return null;\r
+ }\r
+\r
+}\r