diff --git a/interfaces/kits/js/src/mod_fs/properties/move.cpp b/interfaces/kits/js/src/mod_fs/properties/move.cpp index bea653e94752d30de276f435952b5037d3389419..da980d8c0267dfa1e301c0af909ac3efcc55293f 100644 --- a/interfaces/kits/js/src/mod_fs/properties/move.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/move.cpp @@ -15,7 +15,13 @@ #include "move.h" +#ifdef __MUSL__ #include +#else +#include +#include +#endif + #include #include #include "uv.h" @@ -28,6 +34,8 @@ namespace FileManagement { namespace ModuleFileIO { using namespace std; using namespace OHOS::FileManagement::LibN; + +#ifdef __MUSL__ static bool CheckDir(const string &path) { if (!filesystem::is_directory(filesystem::status(path))) { @@ -35,6 +43,20 @@ static bool CheckDir(const string &path) } return true; } +#else +static bool CheckDir(const string &path) +{ + struct stat fileInformation; + if (EOK == stat(path.c_str(), &fileInformation)) { + if (fileInformation.st_mode & S_IFDIR) { + return true; + } + } else { + HILOGE("Failed to stat file"); + } + return false; +} +#endif static tuple, unique_ptr, int> ParseJsOperand(napi_env env, const NFuncArg& funcArg) {