This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
svdragster's profile picture

Search for files - Get file type

Started by svdragster, 08 May 2013 - 11:18 AM
svdragster #1
Posted 08 May 2013 - 01:18 PM
Search will simply find any lost files.

Picture
Spoiler

Program usage:
Spoiler<required> [optional]

<filename>[.filetype]

in shell:
search <filename>[.filetype]

API usage:
Spoilersearch.lookFor(fileName)
It will return true if the file exists.
programName is the file name or the string before the first dot, eg pootis.spencer.txt;
programType is the file type or the string after the last dot, eg pootis.spencer.txt;
programPath is simply the path where the file is.

search.getProgramType(path)
It will return the following variables:
programName is the file name or the string before the first dot, eg pootis.spencer.txt;
programType is the file type or the string after the last dot, eg pootis.spencer.txt;
programPath is simply the path where the file is.

Download:
Spoilerprogram: pastebin get 5WzCxbvg search
API: pastebin get zgeFj06Y search

I guess there are some bugs, so please write them down here…</filename></filename></required>
You can use this API of course, but if you publish a program using it, please credit me ;)/>/>/>
superaxander #2
Posted 08 May 2013 - 04:25 PM
Nice!
alakazard12 #3
Posted 08 May 2013 - 06:22 PM
Simple, but useful. Nice idea!