Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: installer/emb.vbs

Issue 4565805475823616: Issue 1984 - Do not use VBScript in installer build tools (Closed)
Patch Set: Created April 13, 2015, 10:39 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « installer/emb.py ('k') | installer/msibuild.cmd » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 ' Emb.vbs.
2 ' Argument(0) is the name of the storage.
3 ' Argument(1) is the original database.
4 ' Argument(2) is the path to the transform file.
5 ' This was changed from the original to work around a gyp defect involved that r ewrites whole command lines rather than just path-containing variables.
6
7 Option Explicit
8
9 ' Check arguments
10 If WScript.Arguments.Count < 2 Then
11 WScript.Echo "Usage is emb.vbs [storage name] [original database] [transform]"
12 WScript.Quit(1)
13 End If
14
15 ' Connect to Windows Installer object
16 On Error Resume Next
17 Dim installer : Set installer = Nothing
18 Set installer = Wscript.CreateObject("WindowsInstaller.Installer")
19
20 ' Evaluate command-line arguments and set open and update modes
21 Dim databasePath: databasePath = Wscript.Arguments(1)
22 Dim importPath : importPath = Wscript.Arguments(2)
23 Dim storageName : storageName = Wscript.Arguments(0)
24
25 ' Open database and create a view on the _Storages table
26 Dim sqlQuery : sqlQuery = "SELECT `Name`,`Data` FROM _Storages"
27 Dim database : Set database = installer.OpenDatabase(databasePath, 1)
28 Dim view : Set view = database.OpenView(sqlQuery)
29
30 'Create and Insert the row.
31 Dim record : Set record = installer.CreateRecord(2)
32 record.StringData(1) = storageName
33 view.Execute record
34
35 'Insert storage - copy data into stream
36 record.SetStream 2, importPath
37 view.Modify 3, record
38 database.Commit
39 Set view = Nothing
40 Set database = Nothing
OLDNEW
« no previous file with comments | « installer/emb.py ('k') | installer/msibuild.cmd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld