mirror of https://github.com/sbt/sbt.git
IO.touch operates on absolute file
This commit is contained in:
parent
68027501f8
commit
faa0809146
|
|
@ -74,12 +74,13 @@ object IO
|
||||||
/** Creates a file at the given location.*/
|
/** Creates a file at the given location.*/
|
||||||
def touch(file: File, setModified: Boolean = true)
|
def touch(file: File, setModified: Boolean = true)
|
||||||
{
|
{
|
||||||
createDirectory(file.getParentFile)
|
val absFile = file.getAbsoluteFile
|
||||||
val created = translate("Could not create file " + file) { file.createNewFile() }
|
createDirectory(absFile.getParentFile)
|
||||||
if(created || file.isDirectory)
|
val created = translate("Could not create file " + absFile) { absFile.createNewFile() }
|
||||||
|
if(created || absFile.isDirectory)
|
||||||
()
|
()
|
||||||
else if(setModified && !file.setLastModified(System.currentTimeMillis))
|
else if(setModified && !absFile.setLastModified(System.currentTimeMillis))
|
||||||
error("Could not update last modified time for file " + file)
|
error("Could not update last modified time for file " + absFile)
|
||||||
}
|
}
|
||||||
def createDirectories(dirs: Traversable[File]): Unit =
|
def createDirectories(dirs: Traversable[File]): Unit =
|
||||||
dirs.foreach(createDirectory)
|
dirs.foreach(createDirectory)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue