Index: src/rebuild.c ================================================================== --- src/rebuild.c +++ src/rebuild.c @@ -858,11 +858,17 @@ continue; } zUtf8Name = fossil_filename_to_utf8(pEntry->d_name); zSubpath = mprintf("%s/%s", zPath, zUtf8Name); fossil_filename_free(zUtf8Name); - if( file_isdir(zSubpath)==1 ){ +#ifdef _DIRENT_HAVE_D_TYPE + if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) + ? (file_isdir(zSubpath)==1) : (pEntry->d_type==DT_DIR) ) +#else + if( file_isdir(zSubpath)==1 ) +#endif + { recon_read_dir(zSubpath); }else{ blob_init(&path, 0, 0); blob_appendf(&path, "%s", zSubpath); if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){ Index: src/vfile.c ================================================================== --- src/vfile.c +++ src/vfile.c @@ -486,15 +486,25 @@ blob_appendf(pPath, "/%s", zUtf8); zPath = blob_str(pPath); if( glob_match(pIgnore1, &zPath[nPrefix+1]) || glob_match(pIgnore2, &zPath[nPrefix+1]) ){ /* do nothing */ +#ifdef _DIRENT_HAVE_D_TYPE + }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) + ? (file_wd_isdir(zPath)==1) : (pEntry->d_type==DT_DIR) ){ +#else }else if( file_wd_isdir(zPath)==1 ){ +#endif if( !vfile_top_of_checkout(zPath) ){ vfile_scan(pPath, nPrefix, scanFlags, pIgnore1, pIgnore2); } +#ifdef _DIRENT_HAVE_D_TYPE + }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) + ? (file_wd_isfile_or_link(zPath)) : (pEntry->d_type==DT_REG) ){ +#else }else if( file_wd_isfile_or_link(zPath) ){ +#endif if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){ db_bind_text(&ins, ":file", &zPath[nPrefix+1]); db_step(&ins); db_reset(&ins); } @@ -593,11 +603,16 @@ zPath = blob_str(pPath); if( glob_match(pIgnore1, &zPath[nPrefix+1]) || glob_match(pIgnore2, &zPath[nPrefix+1]) || glob_match(pIgnore3, &zPath[nPrefix+1]) ){ /* do nothing */ +#ifdef _DIRENT_HAVE_D_TYPE + }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) + ? (file_wd_isdir(zPath)==1) : (pEntry->d_type==DT_DIR) ){ +#else }else if( file_wd_isdir(zPath)==1 ){ +#endif if( (scanFlags & SCAN_NESTED) || !vfile_top_of_checkout(zPath) ){ char *zSavePath = mprintf("%s", zPath); int count = vfile_dir_scan(pPath, nPrefix, scanFlags, pIgnore1, pIgnore2, pIgnore3); db_bind_text(&ins, ":file", &zSavePath[nPrefix+1]); @@ -605,11 +620,16 @@ db_step(&ins); db_reset(&ins); fossil_free(zSavePath); result += count; /* found X normal files? */ } +#ifdef _DIRENT_HAVE_D_TYPE + }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) + ? (file_wd_isfile_or_link(zPath)) : (pEntry->d_type==DT_REG) ){ +#else }else if( file_wd_isfile_or_link(zPath) ){ +#endif db_bind_text(&upd, ":file", zOrigPath); db_step(&upd); db_reset(&upd); result++; /* found 1 normal file */ }