diff options
Diffstat (limited to 'src/main/java/com/mesasoft/cn/util/CommonUtils.java')
| -rw-r--r-- | src/main/java/com/mesasoft/cn/util/CommonUtils.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main/java/com/mesasoft/cn/util/CommonUtils.java b/src/main/java/com/mesasoft/cn/util/CommonUtils.java new file mode 100644 index 0000000..eebb49b --- /dev/null +++ b/src/main/java/com/mesasoft/cn/util/CommonUtils.java @@ -0,0 +1,26 @@ +package com.mesasoft.cn.util; + +import com.mesasoft.cn.modules.constant.DefaultValues; +import com.zhazhapan.modules.constant.ValueConsts; + +/** + * @author pantao + * @since 2018/1/29 + */ +public class CommonUtils { + + private CommonUtils() {} + + /** + * 将相对路径转换成绝对路径 + * + * @param path 文件路径 + * + * @return {@link String} + */ + public static String checkPath(String path) { + String prefix = DefaultValues.COLON + ValueConsts.SEPARATOR; + return path.startsWith(ValueConsts.SEPARATOR) || path.startsWith(prefix, ValueConsts.ONE_INT) ? path : + DefaultValues.STORAGE_PATH + path; + } +} |
