package com.njcn.gather.system.config;

import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.io.File;

/**
 * @author caozehui
 * @data 2026-05-28
 */
@Component
public class PathConfig {

    private String appPath;

    @PostConstruct
    public void init() {
        // 获取程序运行目录
        appPath = System.getProperty("user.dir");

        // 或者获取jar包所在目录
        // appPath = new File(getClass().getProtectionDomain()
        //     .getCodeSource().getLocation().getPath()).getParent();
    }

    public String getAppPath() {
        return appPath;
    }

    public String getLogPath() {
        return appPath + File.separator + "logs";
    }

    public String getDataPath() {
        return appPath + File.separator + "data";
    }

    public String getReportTemplatePath() {
        return this.getDataPath() + File.separator + "template";
    }

    public String getReportPath() {
        return this.getDataPath() + File.separator + "report";
    }

    public String getResourcePath() {
        return this.getDataPath() + File.separator + "resource";
    }
}