mirror of
https://gitee.com/dromara/hutool.git
synced 2025-05-08 06:37:58 +08:00
Merge pull request #2188 from gongxuanzhang/v5-master
修复Bug:FileCopier的目标文件是相对路径的时候出现异常
This commit is contained in:
commit
87bea48c18
@ -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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件拷贝单元测试
|
* 文件拷贝单元测试
|
||||||
* @author Looly
|
* @author Looly
|
||||||
@ -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