BEAST/BSE - Better Audio System and Sound Engine  0.8.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Classes | Functions
sfifilecrawler.hh File Reference
#include <sfi/sfitypes.hh>
#include <sfi/sfiring.hh>

Go to the source code of this file.

Classes

struct  SfiFileCrawler

Functions

SfiFileCrawlersfi_file_crawler_new (void)
 Create a new file crawler.
gchar * sfi_file_crawler_pop (SfiFileCrawler *self)
void sfi_file_crawler_set_cwd (SfiFileCrawler *self, const gchar *cwd)
void sfi_file_crawler_add_search_path (SfiFileCrawler *self, const gchar *pattern_paths, const gchar *file_pattern)
void sfi_file_crawler_add_tests (SfiFileCrawler *self, GFileTest tests)
void sfi_file_crawler_crawl (SfiFileCrawler *self)
gboolean sfi_file_crawler_needs_crawl (SfiFileCrawler *self)
void sfi_file_crawler_destroy (SfiFileCrawler *self)
SfiRingsfi_file_crawler_list_files (const gchar *search_path, const gchar *file_pattern, GFileTest file_test)
gchar * sfi_path_get_filename (const gchar *filename, const gchar *parentdir)
void sfi_make_dirpath (const gchar *dir)
void sfi_make_dirname_path (const gchar *filename)
gboolean g_file_test_all (const gchar *filename, GFileTest test)
void _sfi_init_file_crawler (void)

Detailed Description


Function Documentation

gboolean g_file_test_all ( const gchar *  file,
GFileTest  test 
)
Parameters:
filea file to test
testbitfield of GFileTest flags

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
void sfi_file_crawler_add_search_path ( SfiFileCrawler self,
const gchar *  pattern_paths,
const gchar *  file_pattern 
)
Parameters:
selfvalid SfiFileCrawler
pattern_pathscolon (semicolon under win32) seperated search path
file_patternwildcard pattern for file names
Returns:
a singly linked list with newly allocated strings

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.

void sfi_file_crawler_add_tests ( SfiFileCrawler self,
GFileTest  tests 
)
Parameters:
selfvalid SfiFileCrawler
testsGFileTest test flags

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.

Parameters:
selfvalid SfiFileCrawler

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.

Parameters:
selfvalid SfiFileCrawler

Destroy an existing file crawler and free any resources allocated by it.

SfiRing* sfi_file_crawler_list_files ( const gchar *  search_path,
const gchar *  file_pattern,
GFileTest  file_test 
)
Parameters:
search_pathcolon (semicolon under win32) seperated search path with '?' and '*' wildcards
file_patternwildcard pattern for file names
cwdassumed current working directoy (to interpret './' in search_path)
file_testGFileTest file test condition (e.g. G_FILE_TEST_IS_REGULAR) or 0
Returns:
an SfiRing with newly allocated strings

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.

Parameters:
selfvalid SfiFileCrawler RETURNS: TRUE if sfi_file_crawler_crawl() should be called

Figure whether collecting all matching files has finished now. If not, sfi_file_crawler_crawl() needs to be called until this function returns FALSE.

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.

Parameters:
selfvalid SfiFileCrawler RETURNS: newly allocated string containig resulting filename

Fetch next result if any or NULL.

void sfi_file_crawler_set_cwd ( SfiFileCrawler self,
const gchar *  cwd 
)
Parameters:
selfvalid SfiFileCrawler
cwdabsolute path

Set the path to be assumed the current working directory.

gchar* sfi_path_get_filename ( const gchar *  filename,
const gchar *  parentdir 
)
Parameters:
filenamepossibly relative filename
parentdirpossibly relative parent directory path
Returns:
a newly allocated absolute pathname

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.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines