- /**
- * 获取项目物理路径
- */
- public static String getProjectPath() {
- String path = CommonUtil.class.getProtectionDomain().getCodeSource().getLocation().getPath();
- if (path.indexOf("WEB-INF") > 0) {
- path = path.substring(0, path.indexOf("/WEB-INF"));
- }
- if (!path.endsWith("/")) {
- path = path + "/";
- }
- if (path.startsWith("/")) {
- path = path.substring(1);
- }
- return path;
- }