public static boolean deleteDir(File dir) {
		if (dir.isDirectory()) {
			for (File file : dir.listFiles()) {
				if (file.isDirectory()) {
					try {
						// Test for symlink and ignore.
						// Robocode won't create one, but just in case a user does...
						if (file.getCanonicalFile().getParentFile().equals(dir.getCanonicalFile())) {
							deleteDir(file);
							if (file.exists() && !file.delete()) {
								Logger.logError("Cannot delete: " + file);
							}
						} else {
							Logger.logWarning(file + " may be a symlink. Ignoring.");
						}
					} catch (IOException e) {
						Logger.logWarning("Cannot determine canonical file for " + file + ". Ignoring.");
					}
				} else {
					if (file.exists() && !file.delete()) {
						Logger.logError("Cannot delete: " + file);
					}
				}
			}
			return dir.delete();
		}
		return false;
	}