Java Code Examples for com.badlogic.gdx.files.FileHandle#deleteDirectory()

The following examples show how to use com.badlogic.gdx.files.FileHandle#deleteDirectory() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileUtils.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public static boolean deleteDir( String name ){
	FileHandle dir = getFileHandle( name );
	
	if (dir == null || !dir.isDirectory()){
		return false;
	} else {
		return dir.deleteDirectory();
	}
}
 
Example 2
Source File: WelcomeScreen.java    From gdx-skineditor with Apache License 2.0 5 votes vote down vote up
/**
 * 
 */
private void showDeleteDialog() {
	
	Dialog dlgStyle = new Dialog("Delete Project", game.skin) {

		@Override
		protected void result(Object object) {
			if ((Boolean) object == false) {
				return;
			}

			// We delete it
			FileHandle projectFolder = Gdx.files.local("projects/" + (String) listProjects.getSelected());
			projectFolder.deleteDirectory();
			
			refreshProjects();
		}

	};

	dlgStyle.pad(20);
	dlgStyle.getContentTable().add(
			"You are sure you want to delete this project?");
	dlgStyle.button("OK", true);
	dlgStyle.button("Cancel", false);
	dlgStyle.key(com.badlogic.gdx.Input.Keys.ENTER, true);
	dlgStyle.key(com.badlogic.gdx.Input.Keys.ESCAPE, false);
	dlgStyle.show(stage);
	
}
 
Example 3
Source File: AtlasData.java    From skin-composer with MIT License 4 votes vote down vote up
public void clearTempData() {
    FileHandle tempFolder = Main.appFolder.child("temp/");
    tempFolder.deleteDirectory();
}
 
Example 4
Source File: Registry.java    From Mundus with Apache License 2.0 4 votes vote down vote up
public void purgeTempDirectory() {
    for (FileHandle f : Gdx.files.absolute(TEMP_DIR).list()) {
        f.deleteDirectory();
    }
}
 
Example 5
Source File: FileChooser.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
@Override
public boolean delete (FileHandle file) {
	return file.deleteDirectory();
}