]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/Utils.java
Merge commit 'd7afa23'
[simantics/platform.git] / bundles / org.simantics.db.procore / src / fi / vtt / simantics / procore / internal / Utils.java
1 package fi.vtt.simantics.procore.internal;\r
2 \r
3 import java.io.File;\r
4 \r
5 import org.eclipse.core.runtime.IPath;\r
6 import org.eclipse.core.runtime.Platform;\r
7 import org.osgi.framework.Bundle;\r
8 \r
9 public class Utils {\r
10     public static File getBaseFile(Bundle b) {\r
11         if(Platform.isRunning()) {\r
12             IPath state = Platform.getStateLocation(b);\r
13             return state.append("debug").toFile();\r
14         } else {\r
15             return new File("");\r
16         }\r
17     }\r
18     public static long convertHexStringToLong(String hex) {\r
19         if (hex.length() < 16)\r
20             return Long.parseLong(hex, 16);\r
21         long f = Long.parseLong(hex.substring(0,1), 16) << 60;\r
22         long l = Long.parseLong(hex.substring(1,16), 16);\r
23         return f | l;\r
24     }\r
25 }\r