The following is an example initialization of a filer instance. When a filer looks up a filename,
it walks the f.path table from top to bottom until the file is found.
If the optional value f.subdir is given, it is implicitly appended to the end of each path in
f.path when doing file lookups.
The optional f.shortcuts table allows to use a drive letter style shortcut for each
path component. Given the example below, passing mmc:/test.txt would expand to
/media/mmc0a/app/test.txt.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
f = filer.new()
f.path = {
"/media/tmp",
"/media/mmc0a",
"/media/df0b",
"/media/nand0a",
"/usr/share",
}
f.shortcuts = {
"tmp:",
"mmc:",
"df:",
"nand:",
"rom:",
}
f.subdir = "app"
After this initialization, the following call to filer:lookup
>
abspath = f:lookup("textlist.csv", "eng")
will try the files in the following order, until a match is found:
/media/tmp/app/eng/textlist.csv
/media/mmc0a/app/eng/textlist.csv
/media/df0b/app/eng/textlist.csv
/media/nand0a/app/eng/textlist.csv
/usr/share/app/eng/textlist.csv
/media/tmp/app/textlist.csv
/media/mmc0a/app/textlist.csv
/media/df0b/app/textlist.csv
/media/nand0a/app/textlist.csv
/usr/share/app/textlist.csv
Note how the language specific paths are tried first, before the generic paths are checked.