2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
|
**
** This routine never counts the two "." and ".." special directory
** entries, even if the provided glob would match them.
*/
int file_directory_list(
const char *zDir, /* Directory to get a listing of */
const char *zGlob, /* Only list objects matching this pattern */
int omitDotFiles, /* Omit files that begin with "." if true */
int nLimit, /* Find at most this many files. 0 means "all" */
char ***pazList /* OUT: Write the list here, if not NULL */
){
void *zNative;
DIR *d;
int n = -1;
int nAlloc = 0;
if( pazList ) *pazList = 0;
zNative = fossil_utf8_to_path(zDir,1);
d = opendir(zNative);
if( d ){
struct dirent *pEntry;
n = 0;
while( (pEntry=readdir(d))!=0 ){
char *zUtf8 = 0;
if( pEntry->d_name[0]==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 ){
int rc;
zUtf8 = fossil_path_to_utf8(pEntry->d_name);
rc = sqlite3_strglob(zGlob, zUtf8);
if( rc ){
|
|
|
>
|
|
|
>
>
|
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
|
**
** This routine never counts the two "." and ".." special directory
** entries, even if the provided glob would match them.
*/
int file_directory_list(
const char *zDir, /* Directory to get a listing of */
const char *zGlob, /* Only list objects matching this pattern */
int omitDotFiles, /* 0: skip "." and "..", 1: no .-files, 2: keep all */
int nLimit, /* Find at most this many files. 0 means "all" */
char ***pazList /* OUT: Write the list here, if not NULL */
){
void *zNative;
DIR *d;
int n = -1;
int nAlloc = 0;
if( pazList ) *pazList = 0;
zNative = fossil_utf8_to_path(zDir,1);
d = opendir(zNative);
if( d ){
struct dirent *pEntry;
n = 0;
while( (pEntry=readdir(d))!=0 ){
char *zUtf8 = 0;
if( pEntry->d_name[0]==0 ) continue;
if( pEntry->d_name[0]=='.'
&& omitDotFiles<2
&& (omitDotFiles==1
/* Skip the special "." and ".." entries unless omitDotFiles>=2 */
|| pEntry->d_name[1]==0
|| (pEntry->d_name[1]=='.' && pEntry->d_name[2]==0)
)
){
continue;
}
if( zGlob ){
int rc;
zUtf8 = fossil_path_to_utf8(pEntry->d_name);
rc = sqlite3_strglob(zGlob, zUtf8);
if( rc ){
|