gmio_stl: add gmio_stl_get_format_file()
This commit is contained in:
parent
9fe35b1fc0
commit
2857f5ca30
@ -86,3 +86,16 @@ gmio_stl_format_t gmio_stl_get_format(gmio_stream_t *stream)
|
||||
/* Fallback case */
|
||||
return GMIO_STL_FORMAT_UNKNOWN;
|
||||
}
|
||||
|
||||
gmio_stl_format_t gmio_stl_get_format_file(const char* filepath)
|
||||
{
|
||||
gmio_stl_format_t format = GMIO_STL_FORMAT_UNKNOWN;
|
||||
FILE* file = fopen(filepath, "rb");
|
||||
|
||||
if (file != NULL) {
|
||||
gmio_stream_t stream = gmio_stream_stdio(file);
|
||||
format = gmio_stl_get_format(&stream);
|
||||
fclose(file);
|
||||
}
|
||||
return format;
|
||||
}
|
||||
|
@ -46,6 +46,17 @@ GMIO_C_LINKAGE_BEGIN
|
||||
GMIO_LIBSTL_EXPORT
|
||||
gmio_stl_format_t gmio_stl_get_format(gmio_stream_t* stream);
|
||||
|
||||
/*! Returns the format of the STL data in file at location \p filepath
|
||||
*
|
||||
* This function is a wrapper around gmio_stl_get_format()
|
||||
*
|
||||
* \param filepath Path to the STL file. A stream is opened with fopen() so
|
||||
* the string shall follow the file name specifications of the running
|
||||
* environment
|
||||
*/
|
||||
GMIO_LIBSTL_EXPORT
|
||||
gmio_stl_format_t gmio_stl_get_format_file(const char* filepath);
|
||||
|
||||
GMIO_C_LINKAGE_END
|
||||
|
||||
#endif /* GMIO_STL_FORMAT_H */
|
||||
|
Loading…
Reference in New Issue
Block a user