FindFile
Code level
Description: | Takes a file name a returns the full path of the a file by that name that exists in the "nearest" directory. |
Returns: | Text |
Usage: | Script Only. |
Function Groups: | File I/O |
Related to: | FileFind | Dir | DriveInfo | FileDialogBox | GetFileAttribs |
Format: | \FindFile(File, ProtectedFile, StopOnFailure, Silent) |
Parameters: |
File |
Required text. The name of the file to search for. It may contain an absolute or relative path. |
ProtectedFile |
Optional Boolean. Set TRUE to indicate that the file must be verified. Defaults to FALSE. |
StopOnFailure |
Optional numeric. If ProtectedFile is TRUE, this sets the action to take if protected file can't be loaded. Set to 1 to stop the application. |
Silent |
Optional numeric. If ProtectedFile is TRUE, this can suppress file protection errors as follows: Set to 1 to silence all errors. |
Comments: |
The nearest directory is the one which is the lowest index in the DirList array. For relative file names, all the working copies will be searched first, followed by the Data directories. |
Example:
Init [ If 1 Main; [ BubbleImage = MakeBitmap(\FindFile("\Bitmaps\Tree.png")); ] ] Main [ Return(Self); GUIBitmap(20, 149, 119, 50, 1, 1, 1, 1, 1 { Scaling }, 0, 0 { Movement }, 1, 0 { Visibility, Reserved }, 0, 0, 0 { Selectability }, BubbleImage); ]