This should work for mingw and linux so far. (cherry picked from commit f92026f98b168f4556d50d3dde403ab6bfd97ff3)