From 1cdbc2d2e04c7ab34d2e5af07567b37c60be571f Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Mon, 11 Jan 2016 23:11:28 -0800 Subject: WIP divide plugin --- jni-library/src/main/scala/ch/jodersky/jni/NativeLoader.scala | 6 +++--- jni-library/src/main/scala/ch/jodersky/jni/Platform.scala | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'jni-library') 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)) + } + } -- cgit v1.2.3