Skip to content

Commit

Permalink
Merge pull request #478 from fnqista/develop
Browse files Browse the repository at this point in the history
Fix windows problems (#472)
  • Loading branch information
eed3si9n authored Oct 5, 2022
2 parents d090b47 + 14c0f72 commit dbe137f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ThisBuild / version := "2.0.0-SNAPSHOT"
ThisBuild / version := "2.0.1-SNAPSHOT"
ThisBuild / organization := "com.eed3si9n"

def scala212 = "2.12.8"
Expand Down
13 changes: 7 additions & 6 deletions src/main/scala/sbtassembly/Assembly.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ object Assembly {
type LazyInputStream = () => InputStream

val defaultShadeRules: Seq[com.eed3si9n.jarjarabrams.ShadeRule] = Nil
val newLine: String = System.lineSeparator()
val newLine: String = "\n"
val indent: String = " " * 2
val newLineIndented: String = newLine + indent

Expand Down Expand Up @@ -530,7 +530,7 @@ object Assembly {
manifest: JManifest,
localTime: Long
): Unit = {
jarFileSystemResource(URI.create(s"jar:file:${output.toPath.toString}")) { jarFs =>
jarFileSystemResource(URI.create(s"jar:${output.toURI}")) { jarFs =>
val manifestPath = jarFs.getPath("META-INF/MANIFEST.MF")
Files.createDirectories(manifestPath.getParent)
val manifestOut = Files.newOutputStream(
Expand Down Expand Up @@ -717,11 +717,12 @@ object Assembly {
}

object PathList {
private val sysFileSep = System.getProperty("file.separator")
private val sysFileSep = "/"

def unapplySeq(path: String): Option[Seq[String]] = {
val split = path.split(if (sysFileSep.equals("""\""")) """\\""" else sysFileSep)
if (split.isEmpty) None
else Some(split.toList)
val sanitizedPath = if (path.contains('\\')) path.replace('\\', '/') else path
val split = sanitizedPath.split(sysFileSep)
if (split.isEmpty) Option.empty
else Option(split.toList)
}
}
2 changes: 1 addition & 1 deletion src/main/scala/sbtassembly/AssemblyUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ private[sbtassembly] object AssemblyUtils {
* @param eof the terminating string to add at the end if needed
* @return an [[AppendEofInputStream]] instance
*/
def apply(is: InputStream, eof: String = System.lineSeparator()) = new AppendEofInputStream(is, eof)
def apply(is: InputStream, eof: String = "\n") = new AppendEofInputStream(is, eof)
}
}
3 changes: 2 additions & 1 deletion src/sbt-test/sbt-assembly/piecemeal/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ lazy val root = (project in file("."))
},
TaskKey[Unit]("check2") := {
val process = sys.process.Process("java", Seq("-cp",
(crossTarget.value / "scala-library-2.12.15-assembly.jar").toString + ":" +
(crossTarget.value / "scala-library-2.12.15-assembly.jar").toString +
(if (scala.util.Properties.isWin) ";" else ":") +
(crossTarget.value / "foo-assembly-0.1.jar").toString,
"Main"))
val out = (process!!)
Expand Down

0 comments on commit dbe137f

Please sign in to comment.