OPTIM: improve path search, return FILE* instead of path.