RuoYi
2023-11-07 8cf8c8acd059969b9e79ad1c2f9f1921cc42d69c
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java
@@ -116,8 +116,7 @@
        // 路径为文件且不为空则进行删除
        if (file.isFile() && file.exists())
        {
            file.delete();
            flag = true;
            flag = file.delete();
        }
        return flag;
    }
@@ -257,8 +256,8 @@
    }
    /**
     * 获取名称
     *  例如: /profile/upload/2022/04/16/ruoyi.png, 返回: ruoyi.png
     * 获取文件名称 /profile/upload/2022/04/16/ruoyi.png -- ruoyi.png
     *
     * @param fileName 路径名称
     * @return 没有文件路径的名称
     */
@@ -275,17 +274,18 @@
    }
    /**
     * 获取名称
     * 例如: /profile/upload/2022/04/16/ruoyi.png, 返回: ruoyi
     * 获取不带后缀文件名称 /profile/upload/2022/04/16/ruoyi.png -- ruoyi
     *
     * @param fileName 路径名称
     * @return 没有文件路径的名称
     * @return 没有文件路径和后缀的名称
     */
    public static String getNameNotSuffix(String fileName) {
        if (fileName == null) {
    public static String getNameNotSuffix(String fileName)
    {
        if (fileName == null)
        {
            return null;
        }
        String baseName = FilenameUtils.getBaseName(fileName);
        return baseName;
    }
}