Changes from review

This commit is contained in:
Joakim Erdfelt 2022-09-06 15:12:32 -05:00
parent c122c99163
commit 1cd0ac4959
No known key found for this signature in database
GPG Key ID: 2D0E1FB8FE4B68B4
5 changed files with 6 additions and 20 deletions

View File

@ -181,16 +181,16 @@ public abstract class Resource
* Equivalent to {@link Files#getLastModifiedTime(Path, LinkOption...)} with the following parameter:
* {@link #getPath()} then returning {@link FileTime#toInstant()}.
*
* @return the last modified time instant, or null if resource doesn't exist or doesn't have a last modified time.
* @return the last modified time instant, or {@link Instant#EPOCH} if unable to obtain last modified.
*/
public Instant lastModified()
{
Path path = getPath();
if (path == null)
return null;
return Instant.EPOCH;
if (!Files.exists(path))
return null;
return Instant.EPOCH;
try
{
@ -200,7 +200,7 @@ public abstract class Resource
catch (IOException e)
{
LOG.trace("IGNORED", e);
return null;
return Instant.EPOCH;
}
}

View File

@ -86,7 +86,7 @@ public class Overlay
throw new IllegalStateException("No overly unpack directory");
//only unpack if the overlay is newer
Instant dirLastModified = Files.getLastModifiedTime(dir.toPath()).toInstant();
if (!dir.exists() || (getResource().lastModified().isAfter(dirLastModified)))
if (!dir.exists() || getResource().lastModified().isAfter(dirLastModified))
getResource().copyTo(dir.toPath());
}
}

View File

@ -18,7 +18,6 @@ import java.io.InputStream;
import java.net.URI;
import java.nio.channels.ReadableByteChannel;
import java.nio.file.Path;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
@ -103,12 +102,6 @@ public class OrderingTest
return false;
}
@Override
public Instant lastModified()
{
return null;
}
@Override
public long length()
{

View File

@ -86,7 +86,7 @@ public class Overlay
throw new IllegalStateException("No overly unpack directory");
//only unpack if the overlay is newer
Instant dirLastModified = Files.getLastModifiedTime(dir.toPath()).toInstant();
if (!dir.exists() || (getResource().lastModified().isAfter(dirLastModified)))
if (!dir.exists() || getResource().lastModified().isAfter(dirLastModified))
getResource().copyTo(dir.toPath());
}
}

View File

@ -18,7 +18,6 @@ import java.io.InputStream;
import java.net.URI;
import java.nio.channels.ReadableByteChannel;
import java.nio.file.Path;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
@ -103,12 +102,6 @@ public class OrderingTest
return false;
}
@Override
public Instant lastModified()
{
return null;
}
@Override
public long length()
{