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

com.soulgalore.velocity.FileTool Maven / Gradle / Ivy

There is a newer version: 1.8.8
Show newest version
package com.soulgalore.velocity;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

public class FileTool {

	private Map simpleCache = new HashMap();

	public static final String TEMPLATE_HOME_PROPERTY = "com.soulgalore.velocity.templates.home";

	public FileTool() {

	}

	// unsync
	public boolean doFileExist(String path) {
		if (simpleCache.containsKey(path))
			return simpleCache.get(path);
		else {
			if (!path.startsWith("/"))
				path = System.getProperty(TEMPLATE_HOME_PROPERTY, ".") + "/"
						+ path;
			File file = new File(path);
			Boolean exists = file.exists();
			simpleCache.put(path, exists);
			return exists;
		}
	}

	// Used for debugging
	public String fullPath(String path) {
		File file = new File(path);
		return file.getAbsolutePath();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy