aboutsummaryrefslogtreecommitdiff
path: root/jni-library/src/main/scala/ch/jodersky
diff options
context:
space:
mode:
Diffstat (limited to 'jni-library/src/main/scala/ch/jodersky')
-rw-r--r--jni-library/src/main/scala/ch/jodersky/jni/NativeLoader.scala6
-rw-r--r--jni-library/src/main/scala/ch/jodersky/jni/Platform.scala6
2 files changed, 9 insertions, 3 deletions
diff --git a/jni-library/src/main/scala/ch/jodersky/jni/NativeLoader.scala b/jni-library/src/main/scala/ch/jodersky/jni/NativeLoader.scala
index 261e52b..c806464 100644
--- a/jni-library/src/main/scala/ch/jodersky/jni/NativeLoader.scala
+++ b/jni-library/src/main/scala/ch/jodersky/jni/NativeLoader.scala
@@ -45,11 +45,11 @@ object NativeLoader {
)
/**
- * Gets the absolute, full path of a resource on the classpath, given a libraryPath
+ * Gets the absolute, full path of a native library on the classpath, given a libraryPath
* and platform.
*/
def fullLibraryPath(libraryPath: String, platform: Platform) = {
- libraryPath + "/native/" + platform.id + "/" + LibraryName
+ libraryPath + "/" + platform.id + "/" + LibraryName
}
private def loadFromJar(libraryPath: String): Unit = {
@@ -66,7 +66,7 @@ object NativeLoader {
}
/**
- * Loads a native library from the available library path or fall back
+ * Loads a native library from the available library path or falls back
* to extracting and loading a native library from available resources.
*/
def load(libraryPath: String, library: String): Unit = try {
diff --git a/jni-library/src/main/scala/ch/jodersky/jni/Platform.scala b/jni-library/src/main/scala/ch/jodersky/jni/Platform.scala
index cff9e95..1ece9e3 100644
--- a/jni-library/src/main/scala/ch/jodersky/jni/Platform.scala
+++ b/jni-library/src/main/scala/ch/jodersky/jni/Platform.scala
@@ -49,4 +49,10 @@ object Platform {
/** Determines platform the current JVM is running on. */
def current = uname
+ /** Parse an id to a platform. */
+ def fromId(id: String) = {
+ val (arch, dashKernel) = id.span(_ != '-')
+ Platform(arch, dashKernel.drop(1))
+ }
+
}