Fix issue when using exe wavtools on Linux #1198
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I encountered this error when trying to use an external .exe wavtool on Linux: (the first image shows the original error, and the second shows the error after I marked temp.bat and temp_helper.bat as executable)
The cause was that OpenUtau creates a temporary batch file to run the wavtool and attempts to run it directly, which does not work on Linux because batch files can only run on Windows or through Wine.
This patch fixes it by creating a temporary shell wrapper to run the batch file, but there were a few other changes I had to make to accommodate this, which is described in more detail in the commit messages (there are 5 commits when really there are 2 because I changed one of the commit messages to be worded more clearly). All of the new code is behind checks for OS.IsLinux(), so none of the new code affects things on Windows, but to make sure, I tested it in a Windows VM and external wavtools and resamplers worked fine.
I don't know if macOS faces the same issue, nor do I know if the same fix would work on macOS (because I have never used a mac or developed anything for a mac), so for now this patch affects only Linux.