Last active
August 29, 2015 14:00
-
-
Save leruaa/be1f27db68391b5463c6 to your computer and use it in GitHub Desktop.
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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