Commit d70711a2 authored by Romain Reuillon's avatar Romain Reuillon

[Tools] fix: entry time

parent 02d0d44a
......@@ -303,12 +303,9 @@ public class TarEntry extends Object implements Cloneable {
/**
* Set this entry's modification time.
*
* @param time
* This entry's new modification time.
* @return This entry's new modification time.
*/
public Date getModTime() {
return new Date(this.modTime * MILLIS_PER_SECOND);
}
public long getModTime() { return this.modTime * MILLIS_PER_SECOND; }
/**
* Get this entry's name.
......
......@@ -80,6 +80,7 @@ package object tar {
dest.toFile.mode = e.getMode
}
}
dest.setLastModified(e.getModTime)
}
// Set directory right after extraction in case some directory are not writable
......@@ -117,7 +118,6 @@ package object tar {
}
def compressXZ(to: File) = {
val outfile = new FileOutputStream(to)
val outxz = new XZOutputStream(outfile, new LZMA2Options(8), org.tukaani.xz.XZ.CHECK_SHA256)
......@@ -198,7 +198,8 @@ package object tar {
}
}
// create the actual tar entry for the directory
new TarEntry(entryName + '/')
val e = new TarEntry(entryName + '/')
e
}
// tar distinguishes symlinks
else if (isSymbolicLink) {
......@@ -216,8 +217,11 @@ package object tar {
// complete current entry by fixing its modes and writing it to the archive
if (source != directory) {
if (!isSymbolicLink) e.setMode(source.mode)
e.setModTime(source.lastModified)
additionalCommand(e)
tos.putNextEntry(e)
if (Files.isRegularFile(source, LinkOption.NOFOLLOW_LINKS)) try Files.copy(source, tos)
finally tos.closeEntry
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment