Search in sources :

Example 1 with PathManager

use of org.terasology.engine.core.PathManager in project Terasology by MovingBlocks.

the class GameProviderTest method init.

@BeforeAll
public static void init() throws NoSuchFieldException, IllegalAccessException, IOException {
    PathManager pathManager = PathManager.getInstance();
    Field savesPathField = pathManager.getClass().getDeclaredField("savesPath");
    savesPathField.setAccessible(true);
    savesPathField.set(pathManager, TMP_SAVES_FOLDER_PATH);
    Field recordsPathField = pathManager.getClass().getDeclaredField("recordingsPath");
    recordsPathField.setAccessible(true);
    recordsPathField.set(pathManager, TMP_RECORDS_FOLDER_PATH);
    Files.createDirectories(TMP_SAVES_FOLDER_PATH);
    Files.createDirectories(TMP_RECORDS_FOLDER_PATH);
    final File file = new File(GameProviderTest.class.getClassLoader().getResource(GAME_MANIFEST_JSON).getFile());
    try {
        manifestExample = com.google.common.io.Files.asCharSource(file, Charsets.UTF_8).read();
    } catch (IOException e) {
        fail("Could not load input file");
    }
}
Also used : PathManager(org.terasology.engine.core.PathManager) Field(java.lang.reflect.Field) IOException(java.io.IOException) File(java.io.File) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 Field (java.lang.reflect.Field)1 BeforeAll (org.junit.jupiter.api.BeforeAll)1 PathManager (org.terasology.engine.core.PathManager)1