]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/Utils.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.db.procore / src / fi / vtt / simantics / procore / internal / Utils.java
diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/Utils.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/Utils.java
new file mode 100644 (file)
index 0000000..b0ac286
--- /dev/null
@@ -0,0 +1,25 @@
+package fi.vtt.simantics.procore.internal;\r
+\r
+import java.io.File;\r
+\r
+import org.eclipse.core.runtime.IPath;\r
+import org.eclipse.core.runtime.Platform;\r
+import org.osgi.framework.Bundle;\r
+\r
+public class Utils {\r
+    public static File getBaseFile(Bundle b) {\r
+        if(Platform.isRunning()) {\r
+            IPath state = Platform.getStateLocation(b);\r
+            return state.append("debug").toFile();\r
+        } else {\r
+            return new File("");\r
+        }\r
+    }\r
+    public static long convertHexStringToLong(String hex) {\r
+        if (hex.length() < 16)\r
+            return Long.parseLong(hex, 16);\r
+        long f = Long.parseLong(hex.substring(0,1), 16) << 60;\r
+        long l = Long.parseLong(hex.substring(1,16), 16);\r
+        return f | l;\r
+    }\r
+}\r