diff src/name/blackcap/exifwasher/exiv2/Initialize.kt @ 22:cd2ca4727b7f

Builds under Windows.
author davidb
date Thu, 16 Apr 2020 11:10:39 -0700
parents 9ac6136c710c
children
line wrap: on
line diff
--- a/src/name/blackcap/exifwasher/exiv2/Initialize.kt	Sun Apr 12 18:46:57 2020 -0700
+++ b/src/name/blackcap/exifwasher/exiv2/Initialize.kt	Thu Apr 16 11:10:39 2020 -0700
@@ -26,24 +26,18 @@
         }
 
         /* use the appropriate binary for the system we're on */
-        val subdir = when(OS.type) {
-            OS.UNIX -> "linux"
-            OS.MAC -> "mac"
-            OS.WINDOWS -> "windows"
-            OS.OTHER -> throw RuntimeException("unsupported OS!")
-        }
-        val ext = when(OS.type) {
-            OS.UNIX -> "so"
-            OS.MAC -> "dylib"
-            OS.WINDOWS -> "dll"
+        val (subdir, pfx, ext) = when(OS.type) {
+            OS.UNIX -> Triple("linux", "lib", ".so")
+            OS.MAC -> Triple("mac", "lib", ".dylib")
+            OS.WINDOWS -> Triple("windows", "", ".dll")
             OS.OTHER -> throw RuntimeException("unsupported OS!")
         }
 
         /* extract to scratch files, if needed, then load */
         val klass = Initialize::class.java
         var myJar = JarFile(File(klass.getProtectionDomain().getCodeSource().getLocation().toURI()))
-        for (base in arrayOf("libexiv2", "libjni")) {
-            val eBase = "${base}.${ext}"
+        for (base in arrayOf("exiv2", "jni")) {
+            val eBase = "${pfx}${base}${ext}"
             val sPath = "name/blackcap/exifwasher/binaries/${subdir}/${eBase}"
             val source = myJar.getJarEntry(sPath)
             if (source == null) {