package it.micegroup.voila2.cartridge.library.javaservice;

import java.io.File;
import java.io.IOException;

import org.apache.commons.io.FileUtils;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Assert;

public class FileCopyUtils {

	public static void copyFiles(String sourceFolder, String targetFolder) {
		File srcDir = new File(sourceFolder);
		File destDir = new File(targetFolder);

		try {
			FileUtils.copyDirectory(srcDir, destDir);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

 	public static boolean exists(IResource res) {
 		Assert.isNotNull(res);
 		return exists(res.getLocation().toFile());
 	}

 	public static boolean exists(File res) {
 		Assert.isNotNull(res);
 		return res.exists();
 	}

}
