mirror of
https://gitee.com/dromara/hutool.git
synced 2025-05-07 14:18:05 +08:00
Merge branch 'v5-dev' of github.com:dromara/hutool into v5-dev
This commit is contained in:
commit
b1e4943e1b
@ -268,7 +268,7 @@ public class FileCopier extends SrcToDestCopier<File, FileCopier>{
|
|||||||
}else {
|
}else {
|
||||||
//路径不存在则创建父目录
|
//路径不存在则创建父目录
|
||||||
//noinspection ResultOfMethodCallIgnored
|
//noinspection ResultOfMethodCallIgnored
|
||||||
dest.getParentFile().mkdirs();
|
dest.getAbsoluteFile().getParentFile().mkdirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
final ArrayList<CopyOption> optionList = new ArrayList<>(2);
|
final ArrayList<CopyOption> optionList = new ArrayList<>(2);
|
||||||
|
@ -5,6 +5,8 @@ import org.junit.Test;
|
|||||||
|
|
||||||
import cn.hutool.core.io.file.FileCopier;
|
import cn.hutool.core.io.file.FileCopier;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件拷贝单元测试
|
* 文件拷贝单元测试
|
||||||
*
|
*
|
||||||
@ -42,4 +44,12 @@ public class FileCopierTest {
|
|||||||
FileCopier copier = FileCopier.create("d:/GReen_Soft/XshellXftpPortable.zip", "c:/hp/");
|
FileCopier copier = FileCopier.create("d:/GReen_Soft/XshellXftpPortable.zip", "c:/hp/");
|
||||||
copier.copy();
|
copier.copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Ignore
|
||||||
|
public void copyFileByRelativePath(){
|
||||||
|
// 当复制的目标文件位置是相对路径的时候可以通过
|
||||||
|
FileCopier copier = FileCopier.create(new File("pom.xml"),new File("aaa.txt"));
|
||||||
|
copier.copy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user