All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bladecoder.engine.util.FileUtils Maven / Gradle / Ivy

There is a newer version: 4.3.1
Show newest version
package com.bladecoder.engine.util;

import com.badlogic.gdx.Application.ApplicationType;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;

public class FileUtils {
	/**
	 * For android, the exists method is very slow, this is a fast
	 * implementation
	 * 
	 * @return true if file exists
	 */
	public static boolean exists(FileHandle fh) {

		if (Gdx.app.getType() == ApplicationType.Android) {
			try {
				fh.read().close();
				return true;
			} catch (Exception e) {
				return false;
			}
		}

		return fh.exists();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy