mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
fix file bug
This commit is contained in:
parent
b1e4943e1b
commit
e5c253042d
@ -21,6 +21,7 @@
|
|||||||
* 【core 】 修复ReflectUtil.getMethods获取接口方法问题(issue#I4WUWR@Gitee)
|
* 【core 】 修复ReflectUtil.getMethods获取接口方法问题(issue#I4WUWR@Gitee)
|
||||||
* 【core 】 修复NamingCase中大写转换问题(pr#572@Gitee)
|
* 【core 】 修复NamingCase中大写转换问题(pr#572@Gitee)
|
||||||
* 【http 】 修复GET重定向时,携带参数问题(issue#2189@Github)
|
* 【http 】 修复GET重定向时,携带参数问题(issue#2189@Github)
|
||||||
|
* 【core 】 修复FileUtil、FileCopier相对路径获取父路径错误问题(pr#2188@Github)
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
# 5.7.22 (2022-03-01)
|
# 5.7.22 (2022-03-01)
|
||||||
|
@ -700,7 +700,7 @@ public class FileUtil extends PathUtil {
|
|||||||
if (null == file) {
|
if (null == file) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return mkdir(file.getParentFile());
|
return mkdir(getParent(file, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -267,8 +267,7 @@ public class FileCopier extends SrcToDestCopier<File, FileCopier>{
|
|||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
//路径不存在则创建父目录
|
//路径不存在则创建父目录
|
||||||
//noinspection ResultOfMethodCallIgnored
|
FileUtil.mkParentDirs(dest);
|
||||||
dest.getAbsoluteFile().getParentFile().mkdirs();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final ArrayList<CopyOption> optionList = new ArrayList<>(2);
|
final ArrayList<CopyOption> optionList = new ArrayList<>(2);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.hutool.core.io;
|
package cn.hutool.core.io;
|
||||||
|
|
||||||
|
import org.junit.Assert;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@ -48,8 +49,11 @@ public class FileCopierTest {
|
|||||||
@Test
|
@Test
|
||||||
@Ignore
|
@Ignore
|
||||||
public void copyFileByRelativePath(){
|
public void copyFileByRelativePath(){
|
||||||
|
// https://github.com/dromara/hutool/pull/2188
|
||||||
// 当复制的目标文件位置是相对路径的时候可以通过
|
// 当复制的目标文件位置是相对路径的时候可以通过
|
||||||
FileCopier copier = FileCopier.create(new File("pom.xml"),new File("aaa.txt"));
|
FileCopier copier = FileCopier.create(new File("pom.xml"),new File("aaa.txt"));
|
||||||
copier.copy();
|
copier.copy();
|
||||||
|
final boolean delete = new File("aaa.txt").delete();
|
||||||
|
Assert.assertTrue(delete);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user