diff options
author | Paul Phillips <paulp@improving.org> | 2009-08-31 18:05:34 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-08-31 18:05:34 +0000 |
commit | c918b70784d41b0aa7efe5eea74e5ec7a4224421 (patch) | |
tree | c6d6fd413bb737a70f9dcbf2cc3250e923f1d968 /src/library | |
parent | 6758ca1bfe59a2b273c4e934d1bb34b736d090fa (diff) | |
download | scala-c918b70784d41b0aa7efe5eea74e5ec7a4224421.tar.gz scala-c918b70784d41b0aa7efe5eea74e5ec7a4224421.tar.bz2 scala-c918b70784d41b0aa7efe5eea74e5ec7a4224421.zip |
Unbreaking fsc with ensureDirectory().
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/io/Path.scala | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/library/scala/io/Path.scala b/src/library/scala/io/Path.scala index 33c893b9be..043cb3e66b 100644 --- a/src/library/scala/io/Path.scala +++ b/src/library/scala/io/Path.scala @@ -147,6 +147,10 @@ class Path private[io] (val jfile: JFile) if (jfile.createNewFile()) new File(jfile) else fail("Failed to create new file.") + /** Like createDirectory, but does not fail if it already exists. */ + def ensureDirectory(force: Boolean = true): Directory = + if (this.isDirectory) this.toDirectory else createDirectory(force) + // deletions def delete() = jfile.delete() def deleteIfExists() = if (jfile.exists()) delete() else false |