3D spaceshooter with online scoreboard, online demos, ship building. Now entirely defunct, but might be resurrected
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
sector/src/net/sector/level/loading/ResourceDirectoryLoader.java

43 lines
844 B

package net.sector.level.loading;
import java.io.InputStream;
import org.newdawn.slick.util.ResourceLoader;
/**
* Directory access in resources
*
* @author Ondřej Hruška (MightyPork)
*/
public class ResourceDirectoryLoader implements DirectoryLoader {
private String path;
/**
* Create resource directory access
*
* @param path the path
*/
public ResourceDirectoryLoader(String path) {
this.path = path;
if (path.endsWith("/")) this.path = path.substring(0, path.length() - 1);
}
@Override
public boolean fileExists(String filename) {
return ResourceLoader.resourceExists(path + "/" + filename);
}
@Override
public InputStream openFile(String filename) {
return ResourceLoader.getResourceAsStream(path + "/" + filename);
}
@Override
public String toString() {
return "Res('" + path + "')";
}
}