From 0cf3d735f4dde814fb7187a482c8a8a89a6fa6a3 Mon Sep 17 00:00:00 2001 From: xuerunlong Date: Wed, 3 Apr 2024 11:09:58 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=AB=98=E9=87=8D=E5=A4=8D=E7=8E=87?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E7=AD=89=E7=BA=A7=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xuerunlong --- .../kits/js/src/mod_fs/class_stream/stream_n_exporter.cpp | 2 +- interfaces/kits/js/src/mod_fs/properties/prop_n_exporter.cpp | 4 ++-- interfaces/kits/js/src/mod_fs/properties/stat.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/interfaces/kits/js/src/mod_fs/class_stream/stream_n_exporter.cpp b/interfaces/kits/js/src/mod_fs/class_stream/stream_n_exporter.cpp index 22b8385f8..dae4d4775 100644 --- a/interfaces/kits/js/src/mod_fs/class_stream/stream_n_exporter.cpp +++ b/interfaces/kits/js/src/mod_fs/class_stream/stream_n_exporter.cpp @@ -208,7 +208,7 @@ napi_value StreamNExporter::Write(napi_env env, napi_callback_info cbInfo) auto streamEntity = NClass::GetEntityOf(env, funcArg.GetThisVar()); if (!streamEntity || !streamEntity->fp) { - HILOGE("Failed to get entity of Stream"); + HILOGD("Failed to get entity of Stream"); NError(EIO).ThrowErr(env); return nullptr; } diff --git a/interfaces/kits/js/src/mod_fs/properties/prop_n_exporter.cpp b/interfaces/kits/js/src/mod_fs/properties/prop_n_exporter.cpp index 3d7b0ecae..5cd66d5a9 100644 --- a/interfaces/kits/js/src/mod_fs/properties/prop_n_exporter.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/prop_n_exporter.cpp @@ -263,7 +263,7 @@ napi_value PropNExporter::UnlinkSync(napi_env env, napi_callback_info info) } int ret = uv_fs_unlink(nullptr, unlink_req.get(), path.get(), nullptr); if (ret < 0) { - HILOGE("Failed to unlink with path"); + HILOGD("Failed to unlink with path"); NError(ret).ThrowErr(env); return nullptr; } @@ -309,7 +309,7 @@ static NError MkdirExec(const string &path, bool recursion, bool hasOption) #endif int ret = MkdirCore(path); if (ret) { - HILOGE("Failed to create directory"); + HILOGD("Failed to create directory"); return NError(ret); } return NError(ERRNO_NOERR); diff --git a/interfaces/kits/js/src/mod_fs/properties/stat.cpp b/interfaces/kits/js/src/mod_fs/properties/stat.cpp index 26e44c86e..44bdcaee1 100644 --- a/interfaces/kits/js/src/mod_fs/properties/stat.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/stat.cpp @@ -58,7 +58,7 @@ static NError CheckFsStat(const FileInfo &fileInfo, uv_fs_t* req) if (fileInfo.isPath) { int ret = uv_fs_stat(nullptr, req, fileInfo.path.get(), nullptr); if (ret < 0) { - HILOGE("Failed to stat file with path"); + HILOGD("Failed to stat file with path"); return NError(ret); } } else { -- Gitee From e02e328ae495c660958c1325d3414b135cceb6f4 Mon Sep 17 00:00:00 2001 From: zhangzhiwei Date: Mon, 8 Apr 2024 10:03:46 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangzhiwei --- .../kits/js/src/mod_fs/properties/prop_n_exporter.cpp | 9 +++++++-- interfaces/kits/js/src/mod_fs/properties/stat.cpp | 5 ++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/interfaces/kits/js/src/mod_fs/properties/prop_n_exporter.cpp b/interfaces/kits/js/src/mod_fs/properties/prop_n_exporter.cpp index 5cd66d5a9..8eaab7e78 100644 --- a/interfaces/kits/js/src/mod_fs/properties/prop_n_exporter.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/prop_n_exporter.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ +#define SPECIAL_ERROR -2 #include "prop_n_exporter.h" #include @@ -263,7 +264,9 @@ napi_value PropNExporter::UnlinkSync(napi_env env, napi_callback_info info) } int ret = uv_fs_unlink(nullptr, unlink_req.get(), path.get(), nullptr); if (ret < 0) { - HILOGD("Failed to unlink with path"); + if (ret != SPECIAL_ERROR) { + HILOGD("Failed to unlink with path"); + } NError(ret).ThrowErr(env); return nullptr; } @@ -309,7 +312,9 @@ static NError MkdirExec(const string &path, bool recursion, bool hasOption) #endif int ret = MkdirCore(path); if (ret) { - HILOGD("Failed to create directory"); + if (ret != SPECIAL_ERROR) { + HILOGD("Failed to create directory"); + } return NError(ret); } return NError(ERRNO_NOERR); diff --git a/interfaces/kits/js/src/mod_fs/properties/stat.cpp b/interfaces/kits/js/src/mod_fs/properties/stat.cpp index 44bdcaee1..60ea0e491 100644 --- a/interfaces/kits/js/src/mod_fs/properties/stat.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/stat.cpp @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#define SPE_ERROR -2 #include "stat.h" #include @@ -58,7 +59,9 @@ static NError CheckFsStat(const FileInfo &fileInfo, uv_fs_t* req) if (fileInfo.isPath) { int ret = uv_fs_stat(nullptr, req, fileInfo.path.get(), nullptr); if (ret < 0) { - HILOGD("Failed to stat file with path"); + if (ret != SPE_ERROR) { + HILOGD("Failed to stat file with path"); + } return NError(ret); } } else { -- Gitee