diff --git a/dirDiffPatch/dir_diff/dir_diff_tools.cpp b/dirDiffPatch/dir_diff/dir_diff_tools.cpp index 1434344f..4c1aa0b9 100644 --- a/dirDiffPatch/dir_diff/dir_diff_tools.cpp +++ b/dirDiffPatch/dir_diff/dir_diff_tools.cpp @@ -118,7 +118,39 @@ hpatch_BOOL hdiff_dirNext(hdiff_TDirHandle dirHandle,hpatch_TPathType *out_type, *out_subName_utf8=0; //finish return hpatch_TRUE; } - + +#ifdef __QNX__ + static char fullName_utf8[hpatch_kPathMaxSize]; + static char subName_utf8[hpatch_kPathMaxSize]; + strncpy(subName_utf8, pdirent->d_name, hpatch_kPathMaxSize - 1); + subName_utf8[hpatch_kPathMaxSize - 1] = '\0'; + *out_subName_utf8 = subName_utf8; + while(pdirent = readdir(pdir)) + { + if (strcmp(pdirent->d_name, ".") == 0 || strcmp(pdirent->d_name, "..") == 0) + { + continue; + } + snprintf(fullName_utf8, hpatch_kPathMaxSize, "%s/%s", subName_utf8, pdirent->d_name); + struct stat sb; + if (stat(fullName_utf8, &sb) == 0) + { + if (S_ISDIR(sb.st_mode)) + { + *out_type = kPathType_dir; + *out_subName_utf8 = fullName_utf8; + } + else + { + *out_type = kPathType_file; + *out_subName_utf8 = fullName_utf8; + } + return hpatch_TRUE; + } + } + *out_subName_utf8 = 0; + return hpatch_TRUE; +#else if (pdirent->d_type==DT_DIR){ *out_type=kPathType_dir; *out_subName_utf8=pdirent->d_name; @@ -130,6 +162,7 @@ hpatch_BOOL hdiff_dirNext(hdiff_TDirHandle dirHandle,hpatch_TPathType *out_type, }else{ return hdiff_dirNext(dirHandle,out_type,out_subName_utf8); } +#endif } void hdiff_dirClose(hdiff_TDirHandle dirHandle){