-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from openmopac/fix-installer
Add system path feature to Qt installer
- Loading branch information
Showing
11 changed files
with
76 additions
and
117 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,66 @@ | ||
function Component() | ||
{ | ||
installer.installationFinished.connect(this, Component.prototype.installationFinishedPageIsShown); | ||
component.loaded.connect(this, addCheckBoxes); | ||
} | ||
|
||
Component.prototype.installationFinishedPageIsShown = function() | ||
addCheckBoxes = function() | ||
{ | ||
/* | ||
if(installer.isInstaller() && (installer.status == QInstaller.Success)) { | ||
if(installer.isInstaller()) { | ||
installer.addWizardPageItem(component, "PathCheckBoxForm", QInstaller.TargetDirectory, 1); | ||
if(systemInfo.kernelType === "winnt") { | ||
installer.addWizardPageItem(component, "FileCheckBoxForm", QInstaller.InstallationFinished, 2); | ||
installer.addWizardPageItem(component, "IconCheckBoxForm", QInstaller.InstallationFinished, 3); | ||
} | ||
else { | ||
installer.addWizardPageItem(component, "PathCheckBoxForm", QInstaller.InstallationFinished, 1); | ||
installer.addWizardPageItem(component, "FileCheckBoxForm", QInstaller.TargetDirectory, 2); | ||
installer.addWizardPageItem(component, "IconCheckBoxForm", QInstaller.TargetDirectory, 3); | ||
} | ||
} | ||
*/ | ||
} | ||
|
||
Component.prototype.createOperations = function() | ||
{ | ||
component.createOperations(); | ||
/* | ||
|
||
var checkboxForm = component.userInterface("PathCheckBoxForm"); | ||
if(checkboxForm && checkboxForm.pathCheckBox.checked) { | ||
if(systemInfo.kernelType === "winnt") { | ||
let target_dir = installer.value("TargetDir").replace(/\//g,"\\"); | ||
let add_path = "$LiteralPath = '" + target_dir + "\\bin'; $regPath = 'registry::HKEY_CURRENT_USER\\Environment'; $currDirs = (Get-Item -LiteralPath $regPath).GetValue('Path', '', 'DoNotExpandEnvironmentNames') -split ';' -ne ''; $newValue = ($currDirs + $LiteralPath) -join ';'; Set-ItemProperty -Type ExpandString -LiteralPath $regPath Path $newValue; $dummyName = [guid]::NewGuid().ToString(); [Environment]::SetEnvironmentVariable($dummyName, 'foo', 'User'); [Environment]::SetEnvironmentVariable($dummyName, [NullString]::value, 'User');"; | ||
let remove_path = "$LiteralPath = '" + target_dir + "\\bin'; $regPath = 'registry::HKEY_CURRENT_USER\\Environment'; $currDirs = (Get-Item -LiteralPath $regPath).GetValue('Path', '', 'DoNotExpandEnvironmentNames') -split ';' -ne ''; $newValue = ($currDirs.Split(';') | Where-Object { $_ -ne $LiteralPath }) -join ';'; Set-ItemProperty -Type ExpandString -LiteralPath $regPath Path $newValue; $dummyName = [guid]::NewGuid().ToString(); [Environment]::SetEnvironmentVariable($dummyName, 'foo', 'User'); [Environment]::SetEnvironmentVariable($dummyName, [NullString]::value, 'User');"; | ||
component.addOperation("Execute", | ||
"@TargetDir@/add-to-path.bat", | ||
"@TargetDir@\bin", | ||
"powershell.exe", | ||
"-Command", | ||
add_path, | ||
"UNDOEXECUTE", | ||
"@TargetDir@/remove-from-path.bat", | ||
"@TargetDir@\bin"); | ||
"powershell.exe", | ||
"-Command", | ||
remove_path); | ||
} | ||
else { | ||
component.addOperation("Execute", | ||
"bash", | ||
"@TargetDir@/add-to-path.sh", | ||
"@TargetDir@/bin", | ||
"UNDOEXECUTE", | ||
"bash", | ||
"@TargetDir@/remove-from-path.sh", | ||
"@TargetDir@/bin"); | ||
component.addOperation("Execute", | ||
"bash", | ||
"@TargetDir@/add-to-path.sh", | ||
"@TargetDir@/lib", | ||
"UNDOEXECUTE", | ||
"bash", | ||
"@TargetDir@/remove-from-path.sh", | ||
"@TargetDir@/lib"); | ||
let path_append = ' PATH="$PATH:@TargetDir@/bin"\n'; | ||
if(systemInfo.kernelType == "darwin") { component.addOperation("AppendFile", "@HomeDir@/.bash_profile", "export" + path_append); } | ||
else { component.addOperation("AppendFile", "@HomeDir@/.bashrc", "export" + path_append); } | ||
component.addOperation("AppendFile", "@HomeDir@/.cshrc", "setenv" + path_append); | ||
component.addOperation("AppendFile", "@HomeDir@/.zshrc", "export" + path_append); | ||
component.addOperation("AppendFile", "@HomeDir@/.profile", "export" + path_append); | ||
} | ||
} | ||
|
||
if(systemInfo.kernelType === "winnt") { | ||
let target_dir = installer.value("TargetDir").replace(/\//g,"\\"); | ||
checkboxForm = component.userInterface("IconCheckBoxForm"); | ||
if(checkboxForm && checkboxForm.iconCheckBox.checked) { | ||
component.addOperation("CreateShortcut", | ||
"@TargetDir@/bin/mopac-win.exe", | ||
"@TargetDir@/bin/mopac.exe", | ||
"@DesktopDir@/MOPAC.lnk", | ||
"iconPath=@TargetDir@/mopac.ico"); | ||
} | ||
checkboxForm = component.userInterface("FileCheckBoxForm"); | ||
if(checkboxForm && checkboxForm.fileCheckBox.checked) { | ||
component.addOperation("RegisterFileType", | ||
".mop", | ||
"@TargetDir@/bin/mopac-win.exe '%1'", | ||
"mop", | ||
target_dir + "\\bin\\mopac.exe \"%1\"", | ||
"MOPAC input file extension", | ||
"text/plain", | ||
"@TargetDir@/mopac.ico"); | ||
target_dir + "\\mopac.ico", | ||
"ProgId=mopac.mop"); | ||
} | ||
} | ||
*/ | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters