package com.ruoyi.geo.constants; import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.utils.StringUtils; public final class GeoSysDir { // 导入日志路径 public static final String LOG = "/log"; // 导入zip临时解压路径 public static final String ZIP_EXTRACT_TEMP = "/unzip"; public static String GetDir(String path) { if(StringUtils.isEmpty(path)) path = ""; else if(!path.startsWith("/")) path = "/" + path; String str = ""; if(!path.startsWith(RuoYiConfig.getProfile())) str += RuoYiConfig.getProfile(); str += path; return str; } public static String CacheDir(String dir) { if(null == dir) dir = ""; return GetDir("/cache" + dir); } public static String ImportDir(String dir) { if(null == dir) dir = ""; return GetDir("/import" + dir); } public static String ExportDir(String dir) { if(null == dir) dir = ""; return GetDir("/export" + dir); } public static String Desensitized(String path) { if(StringUtils.isEmpty(path)) return path; String fpath = path.replaceAll("\\\\", "/"); String fprofile = RuoYiConfig.getProfile().replaceAll("\\\\", "/"); if(!fpath.startsWith(fprofile)) return path; return "" + path.substring(RuoYiConfig.getProfile().length()); } public static String DesensitizedNormalized(String path) { if(StringUtils.isEmpty(path)) return path; String fpath = path.replaceAll("\\\\", "/"); String fprofile = RuoYiConfig.getProfile().replaceAll("\\\\", "/"); if(!fpath.startsWith(fprofile)) return path; return "" + fpath.substring(fprofile.length()); } private GeoSysDir() {} }