summaryrefslogtreecommitdiff
path: root/src/main/java/com/mesasoft/cn/util/CommonUtils.java
blob: eebb49bc0900a228049883f8f289c26ee3b85115 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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;
    }
}