From 72d5f1b1f415ece33f1c71d60e90ef89c93ed293 Mon Sep 17 00:00:00 2001 From: tianp Date: Sat, 2 Aug 2025 15:05:47 +0800 Subject: [PATCH] =?UTF-8?q?move=E6=8E=A5=E5=8F=A3=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: tianp Change-Id: I25823f86cc69dd1bc7112d369839370cebd088a3 --- interfaces/kits/js/src/mod_fs/properties/move_core.cpp | 6 ++++-- interfaces/kits/js/src/mod_fs/properties/move_core.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/interfaces/kits/js/src/mod_fs/properties/move_core.cpp b/interfaces/kits/js/src/mod_fs/properties/move_core.cpp index e53ebd5e0..49b1e116a 100644 --- a/interfaces/kits/js/src/mod_fs/properties/move_core.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/move_core.cpp @@ -62,10 +62,12 @@ static tuple ValidMoveArg(const string &src, const st HILOGE("Invalid src"); return { false, "", "", 0 }; } + if (CheckDir(dest)) { HILOGE("Invalid dest"); return { false, "", "", 0 }; } + int modeType = 0; if (mode.has_value()) { modeType = mode.value(); @@ -79,12 +81,12 @@ static tuple ValidMoveArg(const string &src, const st static int CopyAndDeleteFile(const string &src, const string &dest) { - unique_ptr statReq = { - new (nothrow) uv_fs_t, FsUtils::FsReqCleanup }; + unique_ptr statReq = { new (nothrow) uv_fs_t, FsUtils::FsReqCleanup }; if (!statReq) { HILOGE("Failed to request heap memory."); return ENOMEM; } + int ret = uv_fs_stat(nullptr, statReq.get(), src.c_str(), nullptr); if (ret < 0) { HILOGE("Failed to stat srcPath"); diff --git a/interfaces/kits/js/src/mod_fs/properties/move_core.h b/interfaces/kits/js/src/mod_fs/properties/move_core.h index 52ac3b145..17dd6894b 100644 --- a/interfaces/kits/js/src/mod_fs/properties/move_core.h +++ b/interfaces/kits/js/src/mod_fs/properties/move_core.h @@ -35,4 +35,4 @@ constexpr int MODE_THROW_ERR = 1; } // namespace ModuleFileIO } // namespace FileManagement } // namespace OHOS -#endif \ No newline at end of file +#endif // INTERFACES_KITS_JS_SRC_MOD_FS_PROPERTIES_MOVE_CORE_H \ No newline at end of file -- Gitee