FileBrowser(3I)
π FileBrowser(3I) β like, the whole vibe π
okay bestie, grab your iced coffee because we're diving into FileBrowser from the InterViews Reference Manual and honestly? she's iconic. π¦
β¨ NAME β¨
FileBrowser β browse and/or select file names. that's it, that's the girl. π
πΈ SYNOPSIS πΈ
#include <InterViews/filebrowser.h>
π DESCRIPTION π
okay so FileBrowser is a StringBrowser that displays file names. like, a StringBrowser but make it files. πβ¨
here's the tea: on top of the standard StringBrowser constructor parameters, the FileBrowser constructor also takes a directory name as an argument. then FileBrowser scans that directory and appends all the file names to its list of strings. slay.
FileBrowser lets the user choose a file name, and then the application can go ask the FileBrowser which file got chosen. main character energy fr fr. π
π PUBLIC OPERATIONS π
FileBrowser(ButtonState*, const char* dir, int rows, int cols, boolean uniqueSel, int highlight, const char* done)FileBrowser(const char* name, ButtonState*, const char*, int, int, boolean, int, const char*)
β make a brand new FileBrowser object, no cap. the ButtonState, rows, cols, uniqueSel, highlight, done, and name parameters have semantics identical to those of the corresponding StringBrowser parameters. the dir parameter is the one that says which directory to search for file names. internally, FileBrowser prepends dir to relative path specifications in operations that require them, which is how she avoids a chdir(2). clever girlie. π
boolean IsADirectory(const char*)β returns whether or not the given relative path corresponds to a valid directory. yes or no, bestie, that's all. π«Άboolean SetDirectory(const char* newdir)β change the search directory tonewdirif that directory is accessible. returnstrueif it worked. lowkey the glow-up function. β¨const char* GetDirectory()β returns the name of the search directory. ποΈconst char* ValidDirectories(const char* path)β give her a path string and she returns the largest substring (starting from the beginning ofpath) that represents a valid path. β οΈ heads up: the substring comes back in a static buffer, so you gotta copy it before you use it. don't get caught lacking.const char* Normalize(const char* path)β returns a normalized version ofpathwith all the spurious slashes, dots, and tildes interpreted. so~/./foo//type nonsense gets sorted out. β οΈ same warning bestie: the normalized path is returned in a static buffer, so copy it before use. πconst char* Path(int i)β returns the ith string as it appears in the FileBrowser. what she does: prepends the search directory to the string, normalizes the concatenation, and returns the result. iconic behavior honestly. πvoid RereadDirectory()β rescan the current directory without updating the FileBrowser's appearance. she's looking but not telling anyone. πvirtual void Update()β rescan the current directory and update the FileBrowser's appearance so it reflects any changes in the set of files it should display. full refresh, periodt. π₯void SetTextFilter(const char*)void SetDirectoryTextFilter(const char*)void SetModeFilter(int)void SetDirectoryModeFilter(int)
β okay so by default, FileBrowser displays all the files and directories it finds in the search directory. these four functions give you some control over which entries she shows.
SetTextFilterspecifies a regular expression (seeRegexp(3I)) to match against file names.SetDirectoryTextFilterdoes the same job but for directory names.SetModeFilterandSetDirectoryModeFilterspecify the mode (seechmod(1)) that displayed files and directories should have.
only files and directories that match both the regular expression and the mode will show up in the FileBrowser. passing nil for the regular expression or 0 for the mode restores the default behavior. π§
π¦ PROTECTED OPERATIONS π¦
void UpdateStrings()β explicitly update the FileBrowser's appearance to reflect any changes in the set of files it should display, without rescanning the directory. like refreshing the vibe without redoing the whole photo shoot. πΈvirtual boolean Acceptable(const char*)β returns whether the given file name is an acceptable name. by default, files that conform to the text or mode filter specifications are acceptable. and only acceptable files will be displayed byUpdateStrings. she's picky and honestly? respect. π
π SEE ALSO π
Interactor(2I), Button(3I), StringBrowser(3I), Regexp(3I), chmod(1)
and that's the whole page bestie!! this one came from the InterViews crew, dated 30 November 1989 β yeah she's vintage and she still ate. go forth and browse those files. πβ¨π«Ά
π¦ where this page comes from
- debian bookworm: ivtools-dev 2.0.11d.a1-1+b4
- debian trixie: ivtools-dev 2.0.11d.a1-3+b4
- ubuntu jammy: ivtools-dev 2.0.11d.a1-1build1
- ubuntu noble: ivtools-dev 2.0.11d.a1-3build1
- ubuntu questing: ivtools-dev 2.0.11d.a1-3build7
- ubuntu resolute: ivtools-dev 2.0.11d.a1-3build9
- ubuntu stonking: ivtools-dev 2.1.1+git.2025.07.26.a1-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms