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

mmb.engine.files.FileUtil Maven / Gradle / Ivy

Go to download

Dependency for the MultiMachineBuilder, a voxel game about building an industrial empire in a finite world. THIS RELEASE IS NOT PLAYABLE. To play the game, donwload from >ITCH.IO LINK HERE< or >GH releases link here<

The newest version!
/**
 * 
 */
package mmb.engine.files;

import java.io.File;
import java.net.MalformedURLException;

import mmb.NN;

/**
 * @author oskar
 *
 */
public class FileUtil {
	@NN public static AdvancedFile getFile(String path) throws MalformedURLException {
		if(path.contains("://")) return new OnlineFile(path);
		return new LocalFile(path);
	}

	/** Find all directories located in the given directory
	 * @param root target container directory
	 * @return array of directories
	 */
	public static File[] findDirectories(File root) { 
	    return root.listFiles(File::isDirectory);
	}

	/** Find all files located in the given directory
	 * @param root target container directory
	 * @return array of files
	 */
	public static File[] findFiles(File root) {
		return root.listFiles(File::isFile);
	}	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy