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

Unified Diff: installer/emb.vbs

Issue 5394579117309952: Installer localization and new build system (Closed)
Patch Set: Created Dec. 10, 2013, 4:11 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « installer/adblockplusie.wxs ('k') | installer/installer.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: installer/emb.vbs
===================================================================
new file mode 100644
--- /dev/null
+++ b/installer/emb.vbs
@@ -0,0 +1,40 @@
+' Emb.vbs.
+' Argument(0) is the name of the storage.
+' Argument(1) is the original database.
+' Argument(2) is the path to the transform file.
+' This was changed from the original to work around a gyp defect involved that rewrites whole command lines rather than just path-containing variables.
+
+Option Explicit
+
+' Check arguments
+If WScript.Arguments.Count < 2 Then
+ WScript.Echo "Usage is emb.vbs [storage name] [original database] [transform]"
+ WScript.Quit(1)
+End If
+
+' Connect to Windows Installer object
+On Error Resume Next
+Dim installer : Set installer = Nothing
+Set installer = Wscript.CreateObject("WindowsInstaller.Installer")
+
+' Evaluate command-line arguments and set open and update modes
+Dim databasePath: databasePath = Wscript.Arguments(1)
+Dim importPath : importPath = Wscript.Arguments(2)
+Dim storageName : storageName = Wscript.Arguments(0)
+
+' Open database and create a view on the _Storages table
+Dim sqlQuery : sqlQuery = "SELECT `Name`,`Data` FROM _Storages"
+Dim database : Set database = installer.OpenDatabase(databasePath, 1)
+Dim view : Set view = database.OpenView(sqlQuery)
+
+'Create and Insert the row.
+Dim record : Set record = installer.CreateRecord(2)
+record.StringData(1) = storageName
+view.Execute record
+
+'Insert storage - copy data into stream
+record.SetStream 2, importPath
+view.Modify 3, record
+database.Commit
+Set view = Nothing
+Set database = Nothing
« no previous file with comments | « installer/adblockplusie.wxs ('k') | installer/installer.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld