/******************************************************************************* * Copyright (c) 2012 Pivotal Software, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Pivotal Software, Inc. - initial API and implementation *******************************************************************************/ package org.springsource.ide.eclipse.commons.frameworks.core.util; import java.io.File; import java.io.IOException; /** * @author Steffen Pingel * @author Leo Dos Santos * @author Christian Dupuis * @author Kris De Volder */ public class FileUtil { public static File createTempDirectory(String name) throws IOException { final File temp; temp = File.createTempFile(name, Long.toString(System.nanoTime())); if (!(temp.delete())) { throw new IOException("Could not delete temp file: " + temp.getAbsolutePath()); } if (!(temp.mkdirs())) { throw new IOException("Could not create temp directory: " + temp.getAbsolutePath()); } return (temp); } public static File createTempDirectory() throws IOException { return createTempDirectory("temp"); } }