package com.eversec.common;

import com.eversec.kit.creator.ICreator;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

/**
 * PropertyKit
 * @author: liangxianyou at 2018/10/8 17:51.
 */
public class PropKit {
    public static String clazzRoot = FileKit.rootPath(ICreator.class);
    public static Properties prop = new Properties();
    static {
        try {
            prop.load(new FileInputStream(new File(clazzRoot + "conf/conf.txt")));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static String getProperty(String k, String defaultValue){
        return prop.getProperty(k, defaultValue).replace("${clazzRoot}", clazzRoot);
    }
}
