-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #272 from eed3si9n/bport/windows
[1.3.x] Backport Fixes acquiring timestamp from a file with long path name on Windows
- Loading branch information
Showing
4 changed files
with
47 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* sbt IO | ||
* | ||
* Copyright 2011 - 2019, Lightbend, Inc. | ||
* Copyright 2008 - 2010, Mark Harrah | ||
* | ||
* Licensed under Apache License 2.0 | ||
* (http://www.apache.org/licenses/LICENSE-2.0). | ||
*/ | ||
|
||
package sbt.io | ||
|
||
import java.nio.file.Files | ||
|
||
import org.scalatest.FlatSpec | ||
|
||
class LastModifiedSpec extends FlatSpec { | ||
"IO.getModifiedTimeOrZero" should "work with long path names" in IO.withTemporaryDirectory { | ||
dir => | ||
val fileName = "a" * 32 | ||
val nested = | ||
(1 to 8).foldLeft(dir.toPath) { | ||
case (d, _) => Files.createDirectories(d.resolve(fileName)) | ||
} | ||
val file = Files.createFile(nested.resolve(fileName)).toFile | ||
// in case target platform only has second precision round to nearest second | ||
val lm = (System.currentTimeMillis / 1000) * 1000 | ||
IO.setModifiedTimeOrFalse(file, lm) | ||
assert(IO.getModifiedTimeOrZero(file) == lm) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
sbt.version=1.3.0-RC4 | ||
sbt.version=1.3.0 |