[Mobies-commit] [commit] r4414 - in UDM/trunk: WiX/Udm_SDK src/UIntWizVS
ksmyth at svn.isis.vanderbilt.edu
ksmyth at svn.isis.vanderbilt.edu
Tue Apr 3 13:26:32 CDT 2018
Author: ksmyth
Date: Tue Apr 3 13:26:32 2018
New Revision: 4414
Log:
Visual Studio 2015 interpreter wizard
Added:
UDM/trunk/src/UIntWizVS/setup150.js
Modified:
UDM/trunk/WiX/Udm_SDK/UIntWizVS.wxi
Modified: UDM/trunk/WiX/Udm_SDK/UIntWizVS.wxi
==============================================================================
--- UDM/trunk/WiX/Udm_SDK/UIntWizVS.wxi Tue Apr 3 13:26:26 2018 (r4413)
+++ UDM/trunk/WiX/Udm_SDK/UIntWizVS.wxi Tue Apr 3 13:26:32 2018 (r4414)
@@ -18,6 +18,9 @@
<Component Directory="UIntWizVS" Guid="*" Id="cmpD221EA092661DEFB0997244281E27599">
<File Id="fil435BFE537115BF49C3354ED84F142666" KeyPath="yes" Source="$(var.UIntWizVS)\setup100.js" />
</Component>
+ <Component Directory="UIntWizVS" Guid="*" Id="setup150">
+ <File Id="setup150" KeyPath="yes" Source="$(var.UIntWizVS)\setup150.js" />
+ </Component>
<Component Directory="UIntWizVS" Guid="*" Id="cmp142F705866E119EC6441C7CF1F6B23A7">
<File Id="fil7D13611CF9E23B3F08C21E73361A3BE2" KeyPath="yes" Source="$(var.UIntWizVS)\setup120.js" />
</Component>
Added: UDM/trunk/src/UIntWizVS/setup150.js
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ UDM/trunk/src/UIntWizVS/setup150.js Tue Apr 3 13:26:32 2018 (r4414)
@@ -0,0 +1,221 @@
+// UDM Interpreter Wizard Installer
+// Copyright (C) Vanderbilt University, ISIS
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//
+// This script is based on a similar installer for the WTL library.
+//
+// The use and distribution terms for this software are covered by the
+// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php)
+// which can be found in the file CPL.TXT at the root of this distribution.
+// By using this software in any fashion, you are agreeing to be bound by
+// the terms of this license. You must not remove this notice, or
+// any other, from this software.
+
+main("15.0", "Visual Studio 2017");
+
+function main(vc_ver, vs_ver)
+{
+ // Decode command line arguments
+ var bDebug = false;
+ var bElevated = false;
+ var Args = WScript.Arguments;
+ for(var i = 0; i < Args.length; i++)
+ {
+ if(Args(i) == "/debug")
+ bDebug = true;
+ else if(Args(i) == "/elevated")
+ bElevated = true;
+ }
+
+ // See if UAC is enabled
+ var Shell = WScript.CreateObject("Shell.Application");
+ if(!bElevated && Shell.IsRestricted("System", "EnableLUA"))
+ {
+ // Check that the script is being run interactively.
+ if(!WScript.Interactive)
+ {
+ WScript.Echo("ERROR: Elevation required.");
+ return;
+ }
+
+ // Now relaunch the script, using the "RunAs" verb to elevate
+ var strParams = "\"" + WScript.ScriptFullName + "\"";
+ if (bDebug)
+ strParams += " /debug";
+ strParams += " /elevated";
+ Shell.ShellExecute(WScript.FullName, strParams, null, "RunAs");
+ return;
+ }
+
+ // Create shell object
+ var WSShell = WScript.CreateObject("WScript.Shell");
+ // Create file system object
+ var FileSys = WScript.CreateObject("Scripting.FileSystemObject");
+
+ // Get the folder containing the script file
+ var strValue = FileSys.GetParentFolderName(WScript.ScriptFullName);
+ if(strValue == null || strValue == "")
+ strValue = ".";
+
+ //var strSourceFolder = FileSys.BuildPath(strValue, "Files");
+ var strSourceFolder = strValue;
+
+ if(bDebug)
+ WScript.Echo("Source: " + strSourceFolder);
+
+ if(!FileSys.FolderExists(strSourceFolder))
+ {
+ WScript.Echo("ERROR: Cannot find Wizard folder (should be: " + strSourceFolder + ")");
+ return;
+ }
+
+ try
+ {
+ var strVCKey = "HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\VisualStudio\\SxS\\VS7\\" + vc_ver;
+ strValue = WSShell.RegRead(strVCKey);
+ }
+ catch(e)
+ {
+ WScript.Echo("Cannot find where " + vs_ver + " is installed. UdmInterpreter wizard will be unavailable.");
+ return;
+ }
+ strValue = strValue + "Common7\\IDE\\VC\\"
+
+ var strDestFolder = FileSys.BuildPath(strValue, "vcprojects");
+ if(bDebug)
+ WScript.Echo("Destination: " + strDestFolder);
+ if(!FileSys.FolderExists(strDestFolder))
+ {
+ WScript.Echo("ERROR: Cannot find destination folder (should be: " + strDestFolder + ")");
+ return;
+ }
+
+ // Copy files
+ try
+ {
+ var strSrc = FileSys.BuildPath(strSourceFolder, "UDMInterpreter.ico");
+ var strDest = FileSys.BuildPath(strDestFolder, "UDMInterpreter.ico");
+ FileSys.CopyFile(strSrc, strDest);
+
+ strSrc = FileSys.BuildPath(strSourceFolder, "UDMInterpreterWizard.vsdir");
+ strDest = FileSys.BuildPath(strDestFolder, "UDMInterpreterWizard.vsdir");
+ FileSys.CopyFile(strSrc, strDest);
+ }
+ catch(e)
+ {
+ var strError = "no info";
+ if(e.description.length != 0)
+ strError = e.description;
+ WScript.Echo("ERROR: Cannot copy file (" + strError + ")");
+ return;
+ }
+
+ // Read and write UDMInterpreter.vsz, add engine version and replace path when found
+ try
+ {
+ var strSrc = FileSys.BuildPath(strSourceFolder, "UDMInterpreter.vsz");
+ var strDest = FileSys.BuildPath(strDestFolder, "UDMInterpreter.vsz");
+
+ var ForReading = 1;
+ var fileSrc = FileSys.OpenTextFile(strSrc, ForReading);
+ if(fileSrc == null)
+ {
+ WScript.Echo("ERROR: Cannot open source file " + strSrc);
+ return;
+ }
+
+ var ForWriting = 2;
+ var fileDest = FileSys.OpenTextFile(strDest, ForWriting, true);
+ if(fileDest == null)
+ {
+ WScript.Echo("ERROR: Cannot open destination file" + strDest);
+ return;
+ }
+
+ while(!fileSrc.AtEndOfStream)
+ {
+ var strLine = fileSrc.ReadLine();
+ if(strLine.indexOf("Wizard=VsWizard.VsWizardEngine") != -1)
+ strLine = "Wizard=VsWizard.VsWizardEngine." + vc_ver;
+ else if(strLine.indexOf("WIZARD_VERSION") != -1)
+ strLine = "Param=\"WIZARD_VERSION = " + vc_ver + "\"";
+ else if(strLine.indexOf("ABSOLUTE_PATH") != -1)
+ strLine = "Param=\"ABSOLUTE_PATH = " + strSourceFolder + "\"";
+ fileDest.WriteLine(strLine);
+ }
+
+ fileSrc.Close();
+ fileDest.Close();
+ }
+ catch(e)
+ {
+ var strError = "no info";
+ if(e.description.length != 0)
+ strError = e.description;
+ WScript.Echo("ERROR: Cannot read and write wizard descriptor (UDMInterpreter.vsz) (" + strError + ")");
+ return;
+ }
+
+ // Create UDM folder
+ var strDestGMEFolder = "";
+ try
+ {
+ strDestGMEFolder = FileSys.BuildPath(strDestFolder, "UDM");
+ if(!FileSys.FolderExists(strDestGMEFolder))
+ FileSys.CreateFolder(strDestGMEFolder);
+ if(bDebug)
+ WScript.Echo("GME Folder: " + strDestGMEFolder);
+ }
+ catch(e)
+ {
+ var strError = "no info";
+ if(e.description.length != 0)
+ strError = e.description;
+ WScript.Echo("ERROR: Cannot create GME folder (" + strError + ")");
+ return;
+ }
+
+ // Read and write additional UDMInterpreterWizard.vsdir, add path to the wizard location
+ try
+ {
+ var strSrc = FileSys.BuildPath(strSourceFolder, "UDMInterpreterWizard.vsdir");
+ var strDest = FileSys.BuildPath(strDestGMEFolder, "UDMInterpreterWizard.vsdir");
+
+ var ForReading = 1;
+ var fileSrc = FileSys.OpenTextFile(strSrc, ForReading);
+ if(fileSrc == null)
+ {
+ WScript.Echo("ERROR: Cannot open source file " + strSrc);
+ return;
+ }
+
+ var ForWriting = 2;
+ var fileDest = FileSys.OpenTextFile(strDest, ForWriting, true);
+ if(fileDest == null)
+ {
+ WScript.Echo("ERROR: Cannot open destination file" + strDest);
+ return;
+ }
+
+ while(!fileSrc.AtEndOfStream)
+ {
+ var strLine = fileSrc.ReadLine();
+ if(strLine.indexOf(".vsz|") != -1)
+ strLine = "..\\" + strLine;
+ fileDest.WriteLine(strLine);
+ }
+
+ fileSrc.Close();
+ fileDest.Close();
+ }
+ catch(e)
+ {
+ var strError = "no info";
+ if(e.description.length != 0)
+ strError = e.description;
+ WScript.Echo("ERROR: Cannot read and write GME\\UDMInterpreterWizard.vsdir (" + strError + ")");
+ return;
+ }
+
+// WScript.Echo("UDM Interpreter Wizard successfully installed!");
+}
More information about the Mobies-commit
mailing list