mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-11-30 10:58:14 +08:00
获取当前运行路径
This commit is contained in:
parent
79cd12a0d6
commit
bfb0de40f7
@ -10,6 +10,8 @@
|
||||
|
||||
1. 【Server】 优化判断构建命令中的删除命令关键词
|
||||
2. 【Server】 优化删除构建历史、构建代码(避免不能删除情况)
|
||||
3. 【Agent】 调整项目的jvm 和 args参数支持url编码。避免xss后冲突
|
||||
4. 优化获取项目当前运行路径问题
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -7,6 +7,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.io.LineHandler;
|
||||
import cn.hutool.core.lang.JarClassLoader;
|
||||
import cn.hutool.core.util.ClassUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.system.SystemUtil;
|
||||
import cn.jiangzeyin.common.DefaultSystemLog;
|
||||
@ -18,11 +19,11 @@ import io.jpom.system.ConfigBean;
|
||||
import io.jpom.system.JpomRuntimeException;
|
||||
import io.jpom.util.CommandUtil;
|
||||
import io.jpom.util.JsonFileUtil;
|
||||
import org.springframework.boot.system.ApplicationHome;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.jar.Attributes;
|
||||
@ -190,9 +191,8 @@ public class JpomManifest {
|
||||
* @return jar 或者classPath
|
||||
*/
|
||||
public static File getRunPath() {
|
||||
ApplicationHome home = new ApplicationHome(JpomApplication.getAppClass());
|
||||
String path = (home.getSource() == null ? "" : home.getSource().getAbsolutePath());
|
||||
return FileUtil.file(path);
|
||||
URL location = ClassUtil.getLocation(JpomApplication.getAppClass());
|
||||
return FileUtil.file(location);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user