2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
|
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
|
+
+
+
-
+
+
+
+
+
+
+
|
return z;
}
/*
** Count the number of objects (files and subdirectories) in a given
** directory. Return the count. Return -1 if the object is not a
** directory.
**
** This routine never counts the two "." and ".." special directory
** entries, even if the provided glob would match them.
*/
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( pEntry->d_name[0]=='.' &&
(omitDotFiles
/* Skip the special "." and ".." entries. */
|| pEntry->d_name[1]==0
|| (pEntry->d_name[1]=='.' && pEntry->d_name[2]==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++;
|