Permalink
Browse files

IO.touch operates on absolute file

  • Loading branch information...
1 parent 6802750 commit faa08091468d43d7cd233cd3c572d9f9dada5515 @harrah harrah committed Dec 13, 2011
Showing with 6 additions and 5 deletions.
  1. +6 −5 util/io/IO.scala
View
@@ -74,12 +74,13 @@ object IO
/** Creates a file at the given location.*/
def touch(file: File, setModified: Boolean = true)
{
- createDirectory(file.getParentFile)
- val created = translate("Could not create file " + file) { file.createNewFile() }
- if(created || file.isDirectory)
+ val absFile = file.getAbsoluteFile
+ createDirectory(absFile.getParentFile)
+ val created = translate("Could not create file " + absFile) { absFile.createNewFile() }
+ if(created || absFile.isDirectory)
()
- else if(setModified && !file.setLastModified(System.currentTimeMillis))
- error("Could not update last modified time for file " + file)
+ else if(setModified && !absFile.setLastModified(System.currentTimeMillis))
+ error("Could not update last modified time for file " + absFile)
}
def createDirectories(dirs: Traversable[File]): Unit =
dirs.foreach(createDirectory)

0 comments on commit faa0809

Please sign in to comment.