From 230d397869879bf91be663f4f374e411c27bafc4 Mon Sep 17 00:00:00 2001 From: xuerunlong Date: Mon, 8 Apr 2024 13:49:59 +0800 Subject: [PATCH 1/4] changelog 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 | 5 ++++- interfaces/kits/js/src/mod_fs/properties/stat.cpp | 5 ++++- 3 files changed, 9 insertions(+), 3 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..2f1ca10c9 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) { - HILOGE("Failed to unlink with path"); + if (ret != SPECIAL_ERROR) { + HILOGE("Failed to unlink with path"); + } NError(ret).ThrowErr(env); return nullptr; } diff --git a/interfaces/kits/js/src/mod_fs/properties/stat.cpp b/interfaces/kits/js/src/mod_fs/properties/stat.cpp index 26e44c86e..399a730e6 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) { - HILOGE("Failed to stat file with path"); + if (ret != SPE_ERROR) { + HILOGE("Failed to stat file with path"); + } return NError(ret); } } else { -- Gitee From ae7a40aac9b159f86079e7aabbdcd80d3b44ba8d Mon Sep 17 00:00:00 2001 From: xuerunlong Date: Mon, 8 Apr 2024 14:55:29 +0800 Subject: [PATCH 2/4] =?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: xuerunlong --- interfaces/kits/js/src/mod_fs/properties/prop_n_exporter.cpp | 3 +-- interfaces/kits/js/src/mod_fs/properties/stat.cpp | 3 +-- 2 files changed, 2 insertions(+), 4 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 2f1ca10c9..91ace906a 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,7 +13,6 @@ * limitations under the License. */ -#define SPECIAL_ERROR -2 #include "prop_n_exporter.h" #include @@ -264,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) { - if (ret != SPECIAL_ERROR) { + if (ret != -ENOENT) { HILOGE("Failed to unlink with path"); } NError(ret).ThrowErr(env); diff --git a/interfaces/kits/js/src/mod_fs/properties/stat.cpp b/interfaces/kits/js/src/mod_fs/properties/stat.cpp index 399a730e6..64eba2c21 100644 --- a/interfaces/kits/js/src/mod_fs/properties/stat.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/stat.cpp @@ -12,7 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#define SPE_ERROR -2 #include "stat.h" #include @@ -59,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) { - if (ret != SPE_ERROR) { + if (ret != -ENOENT) { HILOGE("Failed to stat file with path"); } return NError(ret); -- Gitee From d887edc50c4c3a8e979d62b00e86bd0437c7a184 Mon Sep 17 00:00:00 2001 From: xuerunlong Date: Mon, 8 Apr 2024 16:38:47 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=8A=A0ret?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xuerunlong --- interfaces/kits/js/src/mod_fs/properties/prop_n_exporter.cpp | 2 +- interfaces/kits/js/src/mod_fs/properties/stat.cpp | 2 +- 2 files changed, 2 insertions(+), 2 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 91ace906a..edef65673 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 @@ -264,7 +264,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) { if (ret != -ENOENT) { - HILOGE("Failed to unlink with path"); + HILOGE("Failed to unlink with path, result:%{pubilc}d", ret); } NError(ret).ThrowErr(env); return nullptr; diff --git a/interfaces/kits/js/src/mod_fs/properties/stat.cpp b/interfaces/kits/js/src/mod_fs/properties/stat.cpp index 64eba2c21..7a22ac50f 100644 --- a/interfaces/kits/js/src/mod_fs/properties/stat.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/stat.cpp @@ -59,7 +59,7 @@ static NError CheckFsStat(const FileInfo &fileInfo, uv_fs_t* req) int ret = uv_fs_stat(nullptr, req, fileInfo.path.get(), nullptr); if (ret < 0) { if (ret != -ENOENT) { - HILOGE("Failed to stat file with path"); + HILOGE("Failed to stat file with path, result:%{pubilc}d", ret); } return NError(ret); } -- Gitee From f42ff52021cb924e9c61f2453aab062c0b4be89b Mon Sep 17 00:00:00 2001 From: xuerunlong Date: Mon, 8 Apr 2024 17:41:37 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=8A=A0ret?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xuerunlong --- interfaces/kits/js/src/mod_fs/properties/prop_n_exporter.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 edef65673..a0e20a1ec 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 @@ -311,7 +311,9 @@ static NError MkdirExec(const string &path, bool recursion, bool hasOption) #endif int ret = MkdirCore(path); if (ret) { - HILOGE("Failed to create directory"); + if (ret != -ENOENT) { + HILOGE("Failed to create directory, result:%{pubilc}d", ret); + } return NError(ret); } return NError(ERRNO_NOERR); -- Gitee