From c0c2195e1b57e88122efaab6c6442ad2d29c18e4 Mon Sep 17 00:00:00 2001 From: zhangkaixiang Date: Tue, 5 Sep 2023 11:18:56 +0000 Subject: [PATCH] replace space to 040 Signed-off-by: zhangkaixiang --- .../innerkits/native/file_share/src/file_share.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/interfaces/innerkits/native/file_share/src/file_share.cpp b/interfaces/innerkits/native/file_share/src/file_share.cpp index 3f26a933d..5dd2008f3 100644 --- a/interfaces/innerkits/native/file_share/src/file_share.cpp +++ b/interfaces/innerkits/native/file_share/src/file_share.cpp @@ -252,9 +252,16 @@ static bool CheckIsMountPoint(const string &path) return false; } + string encodePath = path; + size_t pos = encodePath.find(" "); + while (pos != string::npos) { + encodePath.replace(pos, 1, "\\040"); + pos = encodePath.find(" ", pos + 1); + } + string tmpLine; while (std::getline(inputStream, tmpLine)) { - if (tmpLine.find(path) != std::string::npos) { + if (tmpLine.find(encodePath) != std::string::npos) { inputStream.close(); return true; } -- Gitee