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 =
|
||||
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.delete(clean)
|
||||
IO.move(mappings.map(_.swap))
|
||||
|
|
|
|||
|
|
@ -574,6 +574,7 @@ object IO
|
|||
{
|
||||
if(b.exists)
|
||||
delete(b)
|
||||
createDirectory(b.getParentFile)
|
||||
if(!a.renameTo(b))
|
||||
{
|
||||
copyFile(a, b, true)
|
||||
|
|
|
|||
Loading…
Reference in New Issue