fixed windows issues

This commit is contained in:
cwaldron97 2019-07-03 14:27:16 -05:00
parent 3926030e24
commit 136b59917c

View file

@ -39,13 +39,11 @@ sealed trait BitcoindInstance extends BitcoinSLogger {
def getVersion: BitcoindVersion = { def getVersion: BitcoindVersion = {
val binaryPath = binary.getAbsolutePath val binaryPath = binary.getAbsolutePath
val foundVersion = if(Properties.isWin)
{Seq(binaryPath, "--version").!!.split("\r\n").head.split(" ").last} val foundVersion =
else{ Seq(binaryPath, "--version").!!.split(Properties.lineSeparator).head
Seq(binaryPath, "--version").!!.split("\n").head .split(" ")
.split(" ") .last
.last
}
foundVersion match { foundVersion match {
case _: String if foundVersion.startsWith(BitcoindVersion.V16.toString) => case _: String if foundVersion.startsWith(BitcoindVersion.V16.toString) =>
@ -90,15 +88,15 @@ object BitcoindInstance {
lazy val DEFAULT_BITCOIND_LOCATION: File = { lazy val DEFAULT_BITCOIND_LOCATION: File = {
val cmd = Try(
val path = if (Properties.isWin) { if (Properties.isWin) {
"which bitcoind.exe".!! "bitcoind.exe".!!
} } else {
else { "bitcoind".!!
Try("which bitcoind".!!) }
.getOrElse( ).getOrElse(
throw new RuntimeException("Could not locate bitcoind on user PATH")) throw new RuntimeException("Could not locate bitcoind on user PATH"))
} val path = cmd
new File(path.trim) new File(path.trim)
} }