Skip to content

Commit

Permalink
Check existence when excluding lib/cache in distros.
Browse files Browse the repository at this point in the history
  • Loading branch information
robby-phd committed Oct 31, 2024
1 parent bfbe2f2 commit 0391017
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions library/jvm/src/main/scala/org/sireum/Init.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1777,8 +1777,12 @@ import Init._
val files: ISZ[String] =
for (p <- distroMap.get(kind).get.map((rp: ISZ[String]) => Os.path(distroDir.name) /+ rp)) yield p.string

val libCache = homeLib / "cache"
val tmp = Os.tempDir()
(homeLib / "cache").moveTo(tmp / "cache")
tmp.removeAll()
if (libCache.exists) {
libCache.moveTo(tmp)
}
if (Os.isWin) {
val pkg = s"$plat.7z"
val p7zz = install7zz()
Expand All @@ -1793,8 +1797,9 @@ import Init._
Os.proc(ISZ[String]("tar", "-c", "-J", "-f", pkg) ++ files).at(distroDir.up).runCheck()
(distroDir.up / pkg).moveOverTo(setupDir.up / pkg)
}
(tmp / "cache").moveTo(homeLib / "cache")
tmp.removeAll()
if (tmp.exists) {
tmp.moveTo(libCache)
}
println("done!")
distroDir.removeAll()
}
Expand Down Expand Up @@ -1872,11 +1877,16 @@ import Init._
binfmt.removeAll()
binfmt.touch()
}
val libCache = homeLib / "cache"
val tmp = Os.tempDir()
(homeLib / "cache").moveTo(tmp / "cache")
Os.proc(ISZ[String]("tar", "-c", if (Os.isWin) "-a" else "-J", "-f", rname) ++ files).at(home.up.canon).runCheck()
(tmp / "cache").moveTo(homeLib / "cache")
tmp.removeAll()
if (libCache.exists) {
libCache.moveTo(tmp)
}
Os.proc(ISZ[String]("tar", "-c", if (Os.isWin) "-a" else "-J", "-f", rname) ++ files).at(home.up.canon).runCheck()
if (tmp.exists) {
tmp.moveTo(libCache)
}
(home.up.canon / rname).moveOverTo(home / "distro" / rname)
}

Expand Down

0 comments on commit 0391017

Please sign in to comment.