--- /dev/null
+Function ReadFile( filePath )\r
+ Dim theFile\r
+\r
+ 'OpenTextFile args: <path>, 1 = ForReading\r
+ 'If you read an empty file, VBScript throws an error for some reason\r
+ if (FileSystemObj.FileExists(filePath)) then\r
+ Set theFile = FileSystemObj.GetFile(filePath)\r
+ if (theFile.size > 0) then\r
+ Set theFile = FileSystemObj.OpenTextFile(filePath, 1)\r
+ ReadFile = theFile.ReadAll\r
+ else\r
+ ReadFile = ""\r
+ end if\r
+ else\r
+ ReadFile = ""\r
+ end if\r
+End Function\r
+\r
+Sub WriteFile( filePath, contents )\r
+ Dim theFile\r
+\r
+ 'OpenTextFile args: <path>, 2 = ForWriting, True = create if not exist\r
+ Set theFile = FileSystemObj.OpenTextFile(filePath, 2, True)\r
+ theFile.Write contents\r
+End Sub\r
+\r
+Sub ReplaceInFile( filePath, lookForStr, replaceWithStr )\r
+ Dim buffer\r
+\r
+ buffer = ReadFile(filePath)\r
+ if (buffer <> "") then\r
+ buffer = Replace(buffer, lookForStr, replaceWithStr)\r
+ WriteFile filePath, buffer\r
+ end if\r
+End Sub\r
+\r
+\r
+Dim FileSystemObj, ConfigFile, ConfigFileName, XMLDir, WshShell\r
+\r
+on error resume next\r
+Set FileSystemObj = CreateObject("Scripting.FileSystemObject")\r
+if (Err = 0) then\r
+\r
+ 'Get the parameters via CustomActionData\r
+ customData = Session.Property("CustomActionData")\r
+ msiProperties = split(customData,";@;")\r
+ XMLDir = msiProperties(0) ' \programdata\shibboleth\sp\xml\opensaml\\r
+ ConfigFileName = msiProperties(1) 'catalog\r
+\r
+ ConfigFile = XMLDir & ConfigFileName\r
+ ReplaceInFile ConfigFile, "@-PKGXMLDIR-@/", XMLDir\r
+\r
+'Last End If\r
+End If
\ No newline at end of file