cache test: get tmpdir from a system property

This commit is contained in:
Adam
2018-01-06 22:25:49 -05:00
parent acf7a0c7a8
commit a29f55362c
2 changed files with 9 additions and 7 deletions

3
cache/pom.xml vendored
View File

@@ -124,6 +124,9 @@
<configuration>
<enableAssertions>true</enableAssertions>
<argLine>-Xmx2048m</argLine>
<systemProperties>
<cache.tmpdir>${cache.tmpdir}</cache.tmpdir>
</systemProperties>
</configuration>
</plugin>
<plugin>

View File

@@ -24,11 +24,11 @@
*/
package net.runelite.cache;
import com.google.common.base.Strings;
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;
@@ -38,18 +38,17 @@ public class StoreLocation
private static final Logger logger = LoggerFactory.getLogger(StoreLocation.class);
private static final int NUM_INDEXES = 16;
private static final String TMP_DIR = "d:/temp";
public static File LOCATION;
private static File TMP;
static
{
File tmp = new File(TMP_DIR);
if (tmp.exists() || tmp.mkdir())
String cacheTmpDir = System.getProperty("cache.tmpdir");
if (!Strings.isNullOrEmpty(cacheTmpDir))
{
System.setProperty("java.io.tmpdir", TMP_DIR);
TMP = tmp;
System.setProperty("java.io.tmpdir", cacheTmpDir);
TMP = new File(cacheTmpDir);
}
try
@@ -99,7 +98,7 @@ public class StoreLocation
@Override
public void after()
{
// don't cleanup if using local tmpdir
// don't cleanup if using cache tmpdir
if (TMP == null)
{
super.after();