cxong / tinydir

Lightweight, portable and easy to integrate C directory and file reader

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Open file from path

cxong opened this issue · comments

commented

Would be nice to have a function that returns a tinydir_file from a path.

int tinydir_file_open(tinydir_file *file, const char *path);

commented

There doesn't seem to be functions that can read a single file without also scanning through the whole directory to open it. So as a naive first implementation, tinydir_file_open can open the parent dir, scan through all the contents for a string match, and return the matching file.