All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.lucidchart.aspell.NativeLibraryLoader.scala Maven / Gradle / Ivy

The newest version!
package com.lucidchart.aspell

import org.apache.commons.io.IOUtils
import java.io._
import resource._

private[aspell] object NativeLibraryLoader {

  def load(name: String) = {
    val tempDirectory = new File(System.getProperty("java.io.tmpdir"))
    val fileName = new File(getClass.getResource(name).getPath).getName
    val file = new File(tempDirectory + File.separator + fileName)
    for {
      libraryStream <- managed(getClass.getResourceAsStream(name))
      fileStream <- managed(new FileOutputStream(file))
    } {
      IOUtils.copy(libraryStream, fileStream)
    }
    System.load(file.getAbsolutePath)
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy