SFI Interface Reference

/opt/src/beast/sfi/sfifilecrawler.h

SYNOPSIS

DESCRIPTION

SfiFileCrawler

/opt/src/beast/sfi/sfifilecrawler.h:25
struct SfiFileCrawler
{
  SfiRing      *results;
  gchar        *cwd;
  SfiRing      *dpatterns;
  GFileTest     ptest;
  SfiRing      *pdqueue;
  GFileTest     stest;
  SfiRing      *dlist;
  gpointer      dhandle;
  GPatternSpec *pspec;
  gchar        *base_dir;
  GFileTest     ftest;
  SfiRing      *accu;
};

_sfi_init_file_crawler

/opt/src/beast/sfi/sfifilecrawler.h:71

g_file_test_all

/opt/src/beast/sfi/sfifilecrawler.h:67
gboolean  g_file_test_all 
(const gchar *filename,
 GFileTest    test);
This is the AND version of g_file_test(). That is, all file tests specified in the test bits have to succed for this function to return TRUE. This function is implemented via birnet_file_check(), which allowes for more detailed mode tests and is recommended over use of this function. Here is the list of possible GFileTest flags:
  • G_FILE_TEST_IS_REGULAR - test for a recular file
  • G_FILE_TEST_IS_SYMLINK - test for a symlink
  • G_FILE_TEST_IS_DIR - test for a directory
  • G_FILE_TEST_IS_EXECUTABLE - test for an executable
  • G_FILE_TEST_EXISTS - test whether the file exists
file: a file to test
test: bitfield of GFileTest flags

sfi_file_crawler_add_search_path

/opt/src/beast/sfi/sfifilecrawler.h:49
void  sfi_file_crawler_add_search_path 
(SfiFileCrawler *self,
 const gchar    *pattern_paths,
 const gchar    *file_pattern);
This function takes a search path (possibly containing wildcards) and adds them to the file crawlers search list. If file_pattern is non NULL, it is appended to each directory element extracted from pattern_paths, before attempting file system searches. sfi_file_crawler_needs_crawl() may return TRUE after calling this function.
self: valid SfiFileCrawler
pattern_paths: colon (semicolon under win32) seperated search path
file_pattern: wildcard pattern for file names
RETURNS: a singly linked list with newly allocated strings

sfi_file_crawler_add_tests

/opt/src/beast/sfi/sfifilecrawler.h:51
By default, results returned by self are only tested for existence. If additional file tests have to be met by the results, they can be set by this function.
self: valid SfiFileCrawler
tests: GFileTest test flags

sfi_file_crawler_crawl

/opt/src/beast/sfi/sfifilecrawler.h:52
Collect the next file or directory if possible, new results need not arrive after calling this function, and more than one may. This function does nothing if sfi_file_crawler_needs_crawl() returns FALSE.
self: valid SfiFileCrawler

sfi_file_crawler_destroy

/opt/src/beast/sfi/sfifilecrawler.h:54
Destroy an existing file crawler and free any resources allocated by it.
self: valid SfiFileCrawler

sfi_file_crawler_list_files

/opt/src/beast/sfi/sfifilecrawler.h:58
SfiRing*  sfi_file_crawler_list_files 
(const gchar *search_path,
 const gchar *file_pattern,
 GFileTest    file_test);
Given a search path with wildcards, list all files matching file_pattern, contained in the directories which the search path matches. Files that do not pass file_test are not listed.
search_path: colon (semicolon under win32) seperated search path with '?' and '*' wildcards
file_pattern: wildcard pattern for file names
cwd: assumed current working directoy (to interpret './' in search_path)
file_test: GFileTest file test condition (e.g. G_FILE_TEST_IS_REGULAR) or 0
RETURNS: an SfiRing with newly allocated strings

sfi_file_crawler_needs_crawl

/opt/src/beast/sfi/sfifilecrawler.h:53
Figure whether collecting all matching files has finished now. If not, sfi_file_crawler_crawl() needs to be called until this function returns FALSE.
self: valid SfiFileCrawler RETURNS: TRUE if sfi_file_crawler_crawl() should be called

sfi_file_crawler_new

/opt/src/beast/sfi/sfifilecrawler.h:43
Create a new file crawler. A file crawler collects all files matching a given search path and file test. sfi_file_crawler_crawl() needs to be called as long as sfi_file_crawler_needs_crawl() returns TRUE to collect all matching files.

sfi_file_crawler_pop

/opt/src/beast/sfi/sfifilecrawler.h:44
Fetch next result if any or NULL.
self: valid SfiFileCrawler RETURNS: newly allocated string containig resulting filename

sfi_file_crawler_set_cwd

/opt/src/beast/sfi/sfifilecrawler.h:46
Set the path to be assumed the current working directory.
self: valid SfiFileCrawler
cwd: absolute path

sfi_make_dirname_path

/opt/src/beast/sfi/sfifilecrawler.h:63

sfi_make_dirpath

/opt/src/beast/sfi/sfifilecrawler.h:62

sfi_path_get_filename

/opt/src/beast/sfi/sfifilecrawler.h:61
gchar*  sfi_path_get_filename 
(const gchar *filename,
 const gchar *parentdir);
Construct an absolute filename from filename, using parentdir as parent directory if filename is not absolute. If parentdir is not absolute, it is assumed to be current directory relative. An exception are filenames starting out with '~' and '~USER', these are interpreted to refer to '/home' or '/home/USER' respectively.
filename: possibly relative filename
parentdir: possibly relative parent directory path
RETURNS: a newly allocated absolute pathname