mirror of https://github.com/sbt/sbt.git
harden clean and IO.move
This commit is contained in:
parent
fe75bade98
commit
1c400db4d9
|
|
@ -287,7 +287,7 @@ object Defaults
|
||||||
|
|
||||||
def doClean(clean: Seq[File], preserve: Seq[File]): Unit =
|
def doClean(clean: Seq[File], preserve: Seq[File]): Unit =
|
||||||
IO.withTemporaryDirectory { temp =>
|
IO.withTemporaryDirectory { temp =>
|
||||||
val mappings = preserve.zipWithIndex map { case (f, i) => (f, new File(temp, i.toHexString)) }
|
val mappings = preserve.filter(_.exists).zipWithIndex map { case (f, i) => (f, new File(temp, i.toHexString)) }
|
||||||
IO.move(mappings)
|
IO.move(mappings)
|
||||||
IO.delete(clean)
|
IO.delete(clean)
|
||||||
IO.move(mappings.map(_.swap))
|
IO.move(mappings.map(_.swap))
|
||||||
|
|
|
||||||
|
|
@ -574,6 +574,7 @@ object IO
|
||||||
{
|
{
|
||||||
if(b.exists)
|
if(b.exists)
|
||||||
delete(b)
|
delete(b)
|
||||||
|
createDirectory(b.getParentFile)
|
||||||
if(!a.renameTo(b))
|
if(!a.renameTo(b))
|
||||||
{
|
{
|
||||||
copyFile(a, b, true)
|
copyFile(a, b, true)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue