// Poly-fill the String trim method.
if(!String.prototype.trim) {
    String.prototype.trim = function() {
        return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
    };
}

// Create the file system object.
var ForReading = 1, ForWriting = 2, ForAppending = 8;
var fso = WScript.CreateObject("Scripting.FileSystemObject");
var filePath = WScript.Arguments(0);

// Read the input project file.
var inputFile = fso.OpenTextFile(filePath, ForReading);
var text = inputFile.ReadAll();
inputFile.Close();
text = text.replace(/.RuntimeLibrary.MultiThreaded..RuntimeLibrary.\s+/g, "");
text = text.replace(/.ExceptionHandling.Sync..ExceptionHandling.\s+/g, "");
text = text.replace(/CharacterSet.MultiByte..CharacterSet/g, "CharacterSet>Unicode</CharacterSet");
text = text.replace(/RuntimeLibrary.MultiThreadedDebug..RuntimeLibrary/g, "RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary");
text = text.replace(/sdk.modules.core.dependencies.openssl.include.vs2017.x../g, "openssl\\Includes\\inc32");
var outputFile = fso.CreateTextFile(filePath, true);
outputFile.Write(text);
outputFile.Close();
