1 Function ReadFile( filePath )
\r
4 'OpenTextFile args: <path>, 1 = ForReading
\r
5 'If you read an empty file, VBScript throws an error for some reason
\r
6 if (FileSystemObj.FileExists(filePath)) then
\r
7 Set theFile = FileSystemObj.GetFile(filePath)
\r
8 if (theFile.size > 0) then
\r
9 Set theFile = FileSystemObj.OpenTextFile(filePath, 1)
\r
10 ReadFile = theFile.ReadAll
\r
19 Sub WriteFile( filePath, contents )
\r
22 'OpenTextFile args: <path>, 2 = ForWriting, True = create if not exist
\r
23 Set theFile = FileSystemObj.OpenTextFile(filePath, 2, True)
\r
24 theFile.Write contents
\r
27 Sub ReplaceInFile( filePath, lookForStr, replaceWithStr )
\r
30 buffer = ReadFile(filePath)
\r
31 if (buffer <> "") then
\r
32 buffer = Replace(buffer, lookForStr, replaceWithStr)
\r
33 WriteFile filePath, buffer
\r
38 Dim FileSystemObj, ConfigFile, ConfigFileName, XMLDir, WshShell
\r
40 on error resume next
\r
41 Set FileSystemObj = CreateObject("Scripting.FileSystemObject")
\r
44 'Get the parameters via CustomActionData
\r
45 customData = Session.Property("CustomActionData")
\r
46 msiProperties = split(customData,";@;")
\r
47 XMLDir = msiProperties(0) ' \programdata\shibboleth\sp\xml\opensaml\
\r
48 ConfigFile = msiProperties(1) 'catalog
\r
50 ReplaceInFile ConfigFile, "@-PKGXMLDIR-@/", XMLDir
\r