C4 Engine
C4 Engine API Documentation


Defined in:  C4FilePicker.h
Returns the name of the file that is currently selected.

String<kMaxFileNameLength> GetFileName(int32 index = 0) const;

index The index of the selected file. If the kFilePickerMultipleSelection flag was not specified, then this should be 0.
The GetFileName function returns the relative path of a file that is currently selected in a file picker. The base directory for the relative path is the directory that was initially specified when the file picker was created. In the case that the kFilePickerSubdirectory was specified, the base directory is the enclosing directory of the initially specified directory.

The index parameter specifies the index of the selected file for which the name is returned. If the kFilePickerMultipleSelection flag was not specified, then index should be omitted. Otherwise, index may be in the range 0 to n − 1, where n is the number of files returned by the FilePicker::GetFileNameCount function.

If no file is selected, the value of the index parameter is out of range, or the requested file name corresponds to a directory, then the return value is the empty string.
See Also