On Mon Feb 13 22:21:48 2023 +0000, Zebediah Figura wrote:
Please don't strip out the code I'm commenting on, that makes this reply hard to read.
These don't need to be inline, do they?
Why not.
Why do they need to be inline?
Do you need these checks?
Yes, yes, maybe.
Why do you need those checks?
Is there some legitimate scenario where this can fail?
Yes, if the model path isn't created.
What do you mean by this?
Isn't the ".." check redundant here?
Not sure what you mean? It's a folder that's always listed so we skip it?
It's already covered by the following prefix checks, isn't it?
Does Vosk really expect every API consumer to do this all manually?
This looks extremely suspicious.
Sort of, yes. They have a Python wrapper for this, but obviously I
don't wanna interface with Python scripts. So they export multiple language bindings, except they require Python in order to do certain basic library tasks like actually finding the models?? And this is all part of stable API?? Can we maybe get a function into their C API to do this for us? This just feels very poorly designed, and not the kind of thing that Wine should have to do.
It seems mildly clearer to add an "else" case here rather than
checking for a previous initialized variable below.
Sorry, I don't understand this one.
I mean something like: if ((env = getenv("XDG_CACHE_HOME"))) suffix = "/vosk"; else if ((env = getenv("HOME"))) suffix = "/.cache/vosk"; else return STATUS_UNSUCCESSFUL; (possibly with some ERR in there, because undefined $HOME seems like a catastrophic failure that the user should know about, but anyway) That way you don't need to initialize the "suffix" variable.
It'd be useful if you used the comment function on the Gitlab website, it's really inconvenient to answer like this.
We need a bunch of other workarounds for Vosk later as well, it's a small tradeoff and the unixlib won't be really big anyway.