Today, I fixed a bug in my opusenc code regarding the output filename when it is not provided.
The issue was that if a file didn’t had an extension, then the output string would be empty, so in reality, the encoded file would not be stored. This has been fixed in my latest commits still awaiting approval to be merged into the official opusenc GitHub repository.
The new updated code is the following:
There are now two “if” conditions that will check if the extension dot (.) was found or if it’s already at a directory level. If we get to a / or \, it means an extension was not found. We break the loop and copy the original file name back. Then, we append the .opus extension. In the “else if”, if the dot (.) is found, then we make “foundExt” equal 1 and break the loop.
The “foundExt” is used to know if we need to copy the whole file path or not. Because the extension was found, we skip the “if (!foundExt)” loop and proceed to contatenate the “.opus” extension to the file path.
And that’s the explanation 😀