FileBrowser(ButtonState*,constchar*dir,introws,intcols,booleanuniqueSel,inthighlight,constchar*done)FileBrowser(constchar*name,ButtonState*,constchar*,int,int,boolean,int,constchar*)
Create a new FileBrowser object. The ButtonState, rows,cols,uniqueSel,highlight,done, and
name parameters have semantics identical to those of the corresponding StringBrowser parameters.
The dir parameter specifies the directory to search for file names. Internally, FileBrowser
prepends dir to relative path specifications in operations that require them, thus avoiding a
chdir(2).
booleanIsADirectory(constchar*)
Return whether or not the given relative path corresponds to a valid directory.
booleanSetDirectory(constchar*newdir)
Change the search directory to newdir if that directory is accessible. The function returns true
if successful.
constchar*GetDirectory()
Return the name of the search directory.
constchar*ValidDirectories(constchar*path)
Given a path string, return the largest substring (starting from the beginning of path) that
represents a valid path. The substring is returned in a static buffer and should be copied before
use.
constchar*Normalize(constchar*path)
Return a normalized version of path with all spurious slashes, dots, and tildes interpreted. The
normalized path is returned in a static buffer and should be copied before use.
constchar*Path(inti)
Return the ith string as it appears in the FileBrowser. This function prepends the search
directory to the string, normalizes the concatenation, and returns the result.
voidRereadDirectory()
Rescan the current directory without updating the FileBrowser's appearance.
virtualvoidUpdate()
Rescan the current directory and update the FileBrowser's appearance to reflect any changes in the
set of files it should display.
voidSetTextFilter(constchar*)voidSetDirectoryTextFilter(constchar*)voidSetModeFilter(int)voidSetDirectoryModeFilter(int)
By default, FileBrowser displays all the files and directories it finds in the search directory.
These functions provide some control over the entries that FileBrowser displays. SetTextFilter
specifies a regular expression (see Regexp(3I)) to match against file names.
SetDirectoryTextFilter serves a similar role for directory names. SetModeFilter and
SetDirectoryModeFilter specify the mode (see chmod(1)) that displayed files and directories should
have. Only files and directories that match both the regular expression and the mode will appear
in the FileBrowser. Passing nil for the regular expression or 0 for the mode restores the default
behavior.