Skip to content

Commit

Permalink
Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
eed3si9n committed Dec 1, 2022
1 parent 490cc99 commit 38e30c0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/PgpSigner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ object PgpSigner {
// This is used to synchronize signing to work around
// https://github.com/sbt/sbt-pgp/issues/168
private[sbtpgp] val lock = new Object

private[sbtpgp] def pathStr(file: File): String =
if (!isWindows) file.getPath
else
sys.env.get("GITHUB_ACTIONS") match {
case Some(_) => file.getPath.replace("\\", "/").replace("C:", "/c")
case _ => file.getPath
}
}

/** A GpgSigner that uses the command-line to run gpg. */
Expand Down Expand Up @@ -62,7 +70,7 @@ class CommandLineGpgSigner(
}) getOrElse Seq.empty
val ringargs: Seq[String] =
optRing match {
case Some(ring) => Seq("--no-default-keyring", "--keyring", ring.getPath)
case Some(ring) => Seq("--no-default-keyring", "--keyring", PgpSigner.pathStr(ring))
case _ => Vector.empty
}
val keyargs: Seq[String] = optKey map (k => Seq("--default-key", k)) getOrElse Seq.empty
Expand Down Expand Up @@ -105,7 +113,7 @@ class CommandLineGpgPinentrySigner(
}) getOrElse Seq.empty
val ringargs: Seq[String] =
optRing match {
case Some(ring) => Seq("--no-default-keyring", "--keyring", ring.getPath)
case Some(ring) => Seq("--no-default-keyring", "--keyring", PgpSigner.pathStr(ring))
case _ => Vector.empty
}
val keyargs: Seq[String] = optKey map (k => Seq("--default-key", k)) getOrElse Seq.empty
Expand Down

0 comments on commit 38e30c0

Please sign in to comment.