Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A FileHandleResolver implementation witch tests if requested file exists in a path starting with an additional folder. This can be useful when using android flavors.
import com.badlogic.gdx.assets.loaders.FileHandleResolver;
import com.badlogic.gdx.files.FileHandle;
public class DualFileHandleResolver implements FileHandleResolver {
private FileHandleResolver baseResolver;
private String additionalAssetsPath;
public DualFileHandleResolver(FileHandleResolver baseResolver, String additionalAssetsPath) {
this.baseResolver = baseResolver;
this.additionalAssetsPath = additionalAssetsPath;
}
@Override
public FileHandle resolve(String fileName) {
FileHandle handle = baseResolver.resolve(String.format("%s/%s", additionalAssetsPath, fileName));
return handle.exists() ? handle : baseResolver.resolve(fileName);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment