cache: extract cache to working directory based on cache version

This commit is contained in:
Adam
2017-05-29 18:21:44 -04:00
parent 1624770d6f
commit 2e5e118df4
3 changed files with 21 additions and 2 deletions

10
cache/pom.xml vendored
View File

@@ -37,6 +37,8 @@
<name>Cache</name>
<properties>
<cache.version>140</cache.version>
<antlr4.version>4.6</antlr4.version>
</properties>
@@ -102,12 +104,18 @@
<dependency>
<groupId>net.runelite.rs</groupId>
<artifactId>cache</artifactId>
<version>140</version>
<version>${cache.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>

View File

@@ -28,6 +28,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.util.Properties;
import org.junit.rules.TemporaryFolder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -61,9 +62,17 @@ public class StoreLocation
}
}
private static Properties getProperies() throws IOException
{
Properties properties = new Properties();
InputStream resourceAsStream = StoreLocation.class.getResourceAsStream("/cache.properties");
properties.load(resourceAsStream);
return properties;
}
private static File setupCacheDir() throws IOException
{
File file = new File(System.getProperty("java.io.tmpdir"), "cache-work");
File file = new File(System.getProperty("java.io.tmpdir"), "cache-" + getProperies().getProperty("cache.version"));
if (file.exists())
{

View File

@@ -0,0 +1,2 @@
cache.version=${cache.version}