1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
|
/*
** Count the number of objects (files and subdirectores) in a given
** directory. Return the count. Return -1 of the object is not a
** directory.
*/
int file_directory_size(const char *zDir, const char *zGlob, int omitDotFiles){
char *zNative;
DIR *d;
int n = -1;
zNative = fossil_utf8_to_path(zDir,1);
d = opendir(zNative);
if( d ){
struct dirent *pEntry;
n = 0;
while( (pEntry=readdir(d))!=0 ){
if( pEntry->d_name[0]==0 ) continue;
if( omitDotFiles && pEntry->d_name[0]=='.' ) continue;
if( zGlob && sqlite3_strglob(zGlob, pEntry->d_name)!=0 ) continue;
n++;
}
closedir(d);
}
fossil_path_free(zNative);
return n;
}
|
|
>
>
|
>
>
>
|
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
|
/*
** Count the number of objects (files and subdirectores) in a given
** directory. Return the count. Return -1 of the object is not a
** directory.
*/
int file_directory_size(const char *zDir, const char *zGlob, int omitDotFiles){
void *zNative;
DIR *d;
int n = -1;
zNative = fossil_utf8_to_path(zDir,1);
d = opendir(zNative);
if( d ){
struct dirent *pEntry;
n = 0;
while( (pEntry=readdir(d))!=0 ){
if( pEntry->d_name[0]==0 ) continue;
if( omitDotFiles && pEntry->d_name[0]=='.' ) continue;
if( zGlob ){
char *zUtf8 = fossil_path_to_utf8(pEntry->d_name);
int rc = sqlite3_strglob(zGlob, zUtf8);
fossil_path_free(zUtf8);
if( rc ) continue;
}
n++;
}
closedir(d);
}
fossil_path_free(zNative);
return n;
}
|