aboutsummaryrefslogtreecommitdiff
path: root/jni-library
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2016-01-11 23:11:28 -0800
committerJakob Odersky <jodersky@gmail.com>2016-01-11 23:11:28 -0800
commit1cdbc2d2e04c7ab34d2e5af07567b37c60be571f (patch)
tree6692fcaf7ec11cbcf1a80b941b9b40094e83db3b /jni-library
parentc85463d30f73a43eb5275c504657a5117c126ca4 (diff)
downloadsbt-jni-1cdbc2d2e04c7ab34d2e5af07567b37c60be571f.tar.gz
sbt-jni-1cdbc2d2e04c7ab34d2e5af07567b37c60be571f.tar.bz2
sbt-jni-1cdbc2d2e04c7ab34d2e5af07567b37c60be571f.zip
WIP divide plugin
Diffstat (limited to 'jni-library')
-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))
+ }
+
}