Fix crash with -main and non-normalized Windows paths in Visual Studio build

The constness casts were silencing a valid compiler warning.