From 08338fae4f095d224f18c16f57221e5da5484b9c Mon Sep 17 00:00:00 2001 From: Iulian Dragos <64069981+iuliand-db@users.noreply.github.com> Date: Wed, 24 Nov 2021 14:24:30 +0100 Subject: [PATCH] Don't fail `os.remove(file)` when the file doesn't exist This is what the docs say, and what `os.remove.all` does, but with a single file it may throw `FileNotFoundException` --- os/src/FileOps.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/os/src/FileOps.scala b/os/src/FileOps.scala index 2a2ad9f7..4733b7a7 100644 --- a/os/src/FileOps.scala +++ b/os/src/FileOps.scala @@ -281,7 +281,7 @@ object copy { * does nothing if there aren't any */ object remove extends Function1[Path, Unit]{ - def apply(target: Path): Unit = Files.delete(target.wrapped) + def apply(target: Path): Unit = Files.deleteIfExists(target.wrapped) object all extends Function1[Path, Unit]{ def apply(target: Path) = {