mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-03-03 18:47:38 +01:00
Merge pull request #563 from cwaldron97/2019-07-02-Windows-implementation-for-bitcoind
Add windows compatability to bitcoind RPC client
This commit is contained in:
commit
53ae772cb3
2 changed files with 22 additions and 8 deletions
|
@ -331,7 +331,12 @@ object BitcoindConfig extends BitcoinSLogger {
|
||||||
"Library",
|
"Library",
|
||||||
"Application Support",
|
"Application Support",
|
||||||
"Bitcoin")
|
"Bitcoin")
|
||||||
} else {
|
} else if (Properties.isWin) {
|
||||||
|
Paths.get("C:",
|
||||||
|
"Program Files",
|
||||||
|
"Bitcoin")
|
||||||
|
}
|
||||||
|
else {
|
||||||
Paths.get(Properties.userHome, ".bitcoin")
|
Paths.get(Properties.userHome, ".bitcoin")
|
||||||
}
|
}
|
||||||
path.toFile
|
path.toFile
|
||||||
|
|
|
@ -9,7 +9,8 @@ import org.bitcoins.rpc.client.common.BitcoindVersion
|
||||||
import scala.sys.process._
|
import scala.sys.process._
|
||||||
import org.bitcoins.core.util.BitcoinSLogger
|
import org.bitcoins.core.util.BitcoinSLogger
|
||||||
import org.bitcoins.core.config.NetworkParameters
|
import org.bitcoins.core.config.NetworkParameters
|
||||||
import scala.util.Try
|
|
||||||
|
import scala.util.{Properties, Try}
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,7 +39,9 @@ sealed trait BitcoindInstance extends BitcoinSLogger {
|
||||||
def getVersion: BitcoindVersion = {
|
def getVersion: BitcoindVersion = {
|
||||||
|
|
||||||
val binaryPath = binary.getAbsolutePath
|
val binaryPath = binary.getAbsolutePath
|
||||||
val foundVersion = Seq(binaryPath, "--version").!!.split("\n").head
|
|
||||||
|
val foundVersion =
|
||||||
|
Seq(binaryPath, "--version").!!.split(Properties.lineSeparator).head
|
||||||
.split(" ")
|
.split(" ")
|
||||||
.last
|
.last
|
||||||
|
|
||||||
|
@ -84,9 +87,15 @@ object BitcoindInstance {
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy val DEFAULT_BITCOIND_LOCATION: File = {
|
lazy val DEFAULT_BITCOIND_LOCATION: File = {
|
||||||
val path = Try("which bitcoind".!!)
|
|
||||||
.getOrElse(
|
val cmd =
|
||||||
throw new RuntimeException("Could not locate bitcoind on user PATH"))
|
if (Properties.isWin) {
|
||||||
|
"which bitcoind.exe".!!
|
||||||
|
} else {
|
||||||
|
"which bitcoind".!!
|
||||||
|
}
|
||||||
|
|
||||||
|
val path = cmd
|
||||||
new File(path.trim)
|
new File(path.trim)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue