Search in sources :

Example 6 with ConfigurationProperty

use of com.google.gwt.core.ext.ConfigurationProperty in project libgdx by libgdx.

the class PreloaderBundleGenerator method getAssetOutputPath.

private String getAssetOutputPath(GeneratorContext context) {
    ConfigurationProperty assetPathProperty = null;
    try {
        assetPathProperty = context.getPropertyOracle().getConfigurationProperty("gdx.assetoutputpath");
    } catch (BadPropertyValueException e) {
        return null;
    }
    if (assetPathProperty.getValues().size() == 0) {
        return null;
    }
    String paths = assetPathProperty.getValues().get(0);
    if (paths == null) {
        return null;
    } else {
        ArrayList<String> existingPaths = new ArrayList<String>();
        String[] tokens = paths.split(",");
        String path = null;
        for (String token : tokens) {
            if (new FileWrapper(token).exists() || new FileWrapper(token).mkdirs()) {
                path = token;
            }
        }
        if (path != null && !path.endsWith("/")) {
            path += "/";
        }
        return path;
    }
}
Also used : ConfigurationProperty(com.google.gwt.core.ext.ConfigurationProperty) ArrayList(java.util.ArrayList) BadPropertyValueException(com.google.gwt.core.ext.BadPropertyValueException)

Example 7 with ConfigurationProperty

use of com.google.gwt.core.ext.ConfigurationProperty in project libgdx by libgdx.

the class PreloaderBundleGenerator method getAssetFilter.

private AssetFilter getAssetFilter(GeneratorContext context) {
    ConfigurationProperty assetFilterClassProperty = null;
    try {
        assetFilterClassProperty = context.getPropertyOracle().getConfigurationProperty("gdx.assetfilterclass");
    } catch (BadPropertyValueException e) {
        return new DefaultAssetFilter();
    }
    if (assetFilterClassProperty.getValues().size() == 0) {
        return new DefaultAssetFilter();
    }
    String assetFilterClass = assetFilterClassProperty.getValues().get(0);
    if (assetFilterClass == null)
        return new DefaultAssetFilter();
    try {
        return (AssetFilter) Class.forName(assetFilterClass).newInstance();
    } catch (Exception e) {
        throw new RuntimeException("Couldn't instantiate custom AssetFilter '" + assetFilterClass + "', make sure the class is public and has a public default constructor", e);
    }
}
Also used : ConfigurationProperty(com.google.gwt.core.ext.ConfigurationProperty) GdxRuntimeException(com.badlogic.gdx.utils.GdxRuntimeException) BadPropertyValueException(com.google.gwt.core.ext.BadPropertyValueException) IOException(java.io.IOException) UnableToCompleteException(com.google.gwt.core.ext.UnableToCompleteException) GdxRuntimeException(com.badlogic.gdx.utils.GdxRuntimeException) BadPropertyValueException(com.google.gwt.core.ext.BadPropertyValueException)

Aggregations

BadPropertyValueException (com.google.gwt.core.ext.BadPropertyValueException)7 ConfigurationProperty (com.google.gwt.core.ext.ConfigurationProperty)7 GdxRuntimeException (com.badlogic.gdx.utils.GdxRuntimeException)2 PropertyOracle (com.google.gwt.core.ext.PropertyOracle)2 UnableToCompleteException (com.google.gwt.core.ext.UnableToCompleteException)2 ArrayList (java.util.ArrayList)2 JClassType (com.google.gwt.core.ext.typeinfo.JClassType)1 NotFoundException (com.google.gwt.core.ext.typeinfo.NotFoundException)1 ClassSourceFileComposerFactory (com.google.gwt.user.rebind.ClassSourceFileComposerFactory)1 SourceWriter (com.google.gwt.user.rebind.SourceWriter)1 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1