From 0621543ae3e12f4229d82cd1b9e6dc5fa39407e0 Mon Sep 17 00:00:00 2001 From: Looly Date: Wed, 2 Aug 2023 17:43:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DPathUtil.moveContent=E5=BD=93?= =?UTF-8?q?target=E4=B8=8D=E5=AD=98=E5=9C=A8=E6=97=B6=E4=BC=9A=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + .../src/main/java/cn/hutool/core/io/file/PathMover.java | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0dc50a38..5147d4e9b 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ ### 🐞Bug修复 * 【core 】 修复NumberUtil.toBigDecimal转换科学计数法问题(issue#3241@Github) +* 【core 】 修复PathUtil.moveContent当target不存在时会报错问题(issue#3238@Github) ------------------------------------------------------------------------------------------------------------- # 5.8.21(2023-07-29) diff --git a/hutool-core/src/main/java/cn/hutool/core/io/file/PathMover.java b/hutool-core/src/main/java/cn/hutool/core/io/file/PathMover.java index b2eca2ca8..926237426 100755 --- a/hutool-core/src/main/java/cn/hutool/core/io/file/PathMover.java +++ b/hutool-core/src/main/java/cn/hutool/core/io/file/PathMover.java @@ -148,6 +148,9 @@ public class PathMover { final CopyOption[] options = this.options; + // 自动创建目标的父目录 + PathUtil.mkParentDirs(target); + // 移动失败,可能是跨分区移动导致的,采用递归移动方式 walkMove(src, target, options); return target;