Skip to content

Commit 97b75ba

Browse files
Got new install process working better
1 parent a6f84d6 commit 97b75ba

17 files changed

+127
-109
lines changed

Launchpad.ahk

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ A_IconHidden := A_IsCompiled
55
#Include Lib\Shared\Includes.ahk
66
#Include Lib\Launchpad\Includes.ahk
77

8-
TraySetIcon("Graphics\Launchpad.ico")
8+
if (FileExist("Graphics\Launchpad.ico")) {
9+
TraySetIcon("Graphics\Launchpad.ico")
10+
}
11+
912

1013
SplitPath(A_ScriptName,,,, appName)
1114

@@ -16,7 +19,8 @@ try {
1619
app.Windows.OpenMainWindow()
1720
} catch e {
1821
extra := (e.HasProp("Extra") and e.Extra != "") ? "`n`nAdditional info:`n" . e.Extra : ""
19-
MsgBox "An unhandled exception has occurred in " . e.What . ".`n`n" . e.Message . extra . "`n`nLaunchpad will now exit."
22+
occurredIn := e.What ? " in " . e.What : ""
23+
MsgBox "An unhandled exception has occurred" . occurredIn . ".`n`n" . e.Message . extra . "`n`nDebugging Information:`nFile: " . e.File . "`nLine: " . e.Line . "`n`nLaunchpad will now exit."
2024
ExitApp
2125
}
2226

Lib/Launchpad/BulkOperation/InstallOp.ahk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class InstallOp extends BulkOperationBase {
3333

3434
for index, installerKey in this.installerKeys {
3535
installer := this.app.Installers.GetInstaller(installerKey)
36-
count += installer.CountAssets()
36+
count += installer.CountComponents()
3737
}
3838

3939
return count

Lib/Launchpad/Installer/DependencyInstaller.ahk

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,45 @@ class DependencyInstaller extends InstallerBase {
22
name := "Launchpad Dependency Installer"
33
version := "latest"
44

5-
__New(appState, cache, extraAssets := "", tmpDir := "") {
6-
assets := []
5+
__New(appState, cache, extraComponents := "", tmpDir := "") {
6+
components := []
77

88
dbVersion := "1.0.2"
99

1010
ahkUrl := "https://www.autohotkey.com/download/2.0/AutoHotkey_" . A_AhkVersion . ".zip"
1111
ahkPath := "Vendor\AutoHotKey"
12-
ahkAsset := DownloadableInstallerAsset.new(ahkUrl, true, ahkPath, appState, "AutoHotKey", cache, "Dependencies", true, tmpDir, false)
13-
ahkAsset.version := A_AhkVersion
14-
assets.Push(ahkAsset)
12+
ahkComponent := DownloadableInstallerComponent.new(ahkUrl, true, ahkPath, appState, "AutoHotKey", cache, "Dependencies", true, tmpDir, false)
13+
ahkComponent.version := A_AhkVersion
14+
components.Push(ahkComponent)
1515

1616
mpressUrl := "https://github.com/bmcclure/launcher-db/releases/download/" . dbVersion . "/mpress.exe"
1717
mpressPath := "Vendor\AutoHotKey\Compiler\mpress.exe"
18-
mpressAsset := DownloadableInstallerAsset.new(mpressUrl, false, mpressPath, appState, "Mpress", cache, "AutoHotKey", true, tmpDir, false)
19-
mpressAsset.version := dbVersion
20-
assets.Push(mpressAsset)
18+
mpressComponent := DownloadableInstallerComponent.new(mpressUrl, false, mpressPath, appState, "Mpress", cache, "AutoHotKey", true, tmpDir, false)
19+
mpressComponent.version := dbVersion
20+
components.Push(mpressComponent)
2121

2222
ahk2ExeUrl := "https://github.com/bmcclure/launcher-db/releases/download/" . dbVersion . "/Ahk2Exe.exe"
2323
ahk2ExePath := "Vendor\AutoHotKey\Compiler\Ahk2Exe.exe"
24-
ahk2ExeAsset := DownloadableInstallerAsset.new(ahk2ExeUrl, false, ahk2ExePath, appState, "Ahk2Exe", cache, "AutoHotKey", true, tmpDir, false)
25-
ahk2ExeAsset.version := dbVersion
26-
assets.Push(ahk2ExeAsset)
24+
ahk2ExeComponent := DownloadableInstallerComponent.new(ahk2ExeUrl, false, ahk2ExePath, appState, "Ahk2Exe", cache, "AutoHotKey", true, tmpDir, false)
25+
ahk2ExeComponent.version := dbVersion
26+
components.Push(ahk2ExeComponent)
2727

28-
assets.Push(GitHubReleaseInstallerAsset.new("dafzor/bnetlauncher", "", true, "Vendor\BnetLauncher", appState, "BnetLauncher", cache, "Dependencies", true, tmpDir, false))
28+
components.Push(GitHubReleaseInstallerComponent.new("dafzor/bnetlauncher", "", true, "Vendor\BnetLauncher", appState, "BnetLauncher", cache, "Dependencies", true, tmpDir, false))
2929

30-
assetUrl := "https://benmcclure.com/launcher-db/Assets/Dependencies/BnetLauncher/gamedb.ini"
31-
assetPath := "Vendor\BnetLauncher\gamedb.ini"
32-
assets.Push(DownloadableInstallerAsset.new(assetUrl, false, assetPath, appState, "GameDbIni", cache, "BnetLauncher", true, tmpDir, false))
30+
componentUrl := "https://benmcclure.com/launcher-db/Components/Dependencies/BnetLauncher/gamedb.ini"
31+
componentPath := "Vendor\BnetLauncher\gamedb.ini"
32+
components.Push(DownloadableInstallerComponent.new(componentUrl, false, componentPath, appState, "GameDbIni", cache, "BnetLauncher", true, tmpDir, false))
3333

3434
iconsExtUrl := "https://www.nirsoft.net/utils/iconsext.zip"
3535
iconsExtPath := "Vendor\IconsExt"
36-
assets.Push(DownloadableInstallerAsset.new(iconsExtUrl, true, iconsExtPath, appState, "IconsExt", cache, "Dependencies", false, tmpDir, false))
36+
components.Push(DownloadableInstallerComponent.new(iconsExtUrl, true, iconsExtPath, appState, "IconsExt", cache, "Dependencies", false, tmpDir, false))
3737

38-
if (extraAssets != "") {
39-
for (index, asset in extraAssets) {
40-
assets.Push(asset)
38+
if (extraComponents != "") {
39+
for (index, component in extraComponents) {
40+
components.Push(component)
4141
}
4242
}
4343

44-
super.__New(appState, "Dependencies", cache, assets, tmpDir := "")
44+
super.__New(appState, "Dependencies", cache, components, tmpDir := "")
4545
}
4646
}

Lib/Launchpad/Installer/LaunchpadExeInstaller.ahk

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ class LaunchpadExeInstaller extends InstallerBase {
88
SplitPath(A_ScriptFullPath,,,,scriptNameNoExt)
99
this.isUpdater := scriptNameNoExt == this.appName . "Updater"
1010

11-
assets := []
11+
components := []
1212

1313
if (this.isUpdater) {
14-
asset := GitHubReleaseInstallerAsset.new("VolantisDev/Launchpad", this.appName . ".exe", false, "", appState, "LaunchpadExe", cache, this.appName, true, tmpDir, true)
15-
asset.version := this.version
16-
assets.Push(asset)
14+
component := GitHubReleaseInstallerComponent.new("VolantisDev/Launchpad", this.appName . ".exe", false, "", appState, "LaunchpadExe", cache, this.appName, true, tmpDir, true)
15+
component.version := this.version
16+
components.Push(component)
1717
}
1818

19-
super.__New(appState, "LaunchpadExeInstaller", cache, assets, tmpDir)
19+
super.__New(appState, "LaunchpadExeInstaller", cache, components, tmpDir)
2020
}
2121

2222
Install(progress := "") {
@@ -29,8 +29,8 @@ class LaunchpadExeInstaller extends InstallerBase {
2929
this.movedApp := true
3030
this.scriptDir := installDir
3131

32-
for (index, asset in this.installerAssets) {
33-
asset.scriptDir := installDir
32+
for (index, component in this.installerComponents) {
33+
component.scriptDir := installDir
3434
}
3535
}
3636
}

Lib/Launchpad/Installer/LaunchpadInstaller.ahk

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ class LaunchpadInstaller extends InstallerBase {
44
version := "latest"
55

66
__New(appState, cache, tmpDir := "") {
7-
assets := []
7+
components := []
88

9-
asset := GitHubReleaseInstallerAsset.new("VolantisDev/Launchpad", "LaunchpadUpdater.exe", true, "", appState, "LaunchpadUpdater", cache, this.appName, true, tmpDir, true)
10-
asset.version := this.version
11-
assets.Push(asset)
9+
component := GitHubReleaseInstallerComponent.new("VolantisDev/Launchpad", "LaunchpadUpdater.exe", false, "LaunchpadUpdater.exe", appState, "LaunchpadUpdater", cache, this.appName, true, tmpDir, true)
10+
component.version := this.version
11+
components.Push(component)
1212

13-
asset := GitHubReleaseInstallerAsset.new("VolantisDev/Launchpad", "LaunchpadGraphics.zip", true, "Graphics", appState, "LaunchpadGraphics", cache, this.appName, true, tmpDir, true)
14-
asset.version := this.version
15-
assets.Push(asset)
13+
component := GitHubReleaseInstallerComponent.new("VolantisDev/Launchpad", "LaunchpadGraphics.zip", true, "Graphics", appState, "LaunchpadGraphics", cache, this.appName, true, tmpDir, true)
14+
component.version := this.version
15+
components.Push(component)
1616

17-
super.__New(appState, this.appName, cache, assets, tmpDir)
17+
super.__New(appState, this.appName, cache, components, tmpDir)
1818
}
1919
}

Lib/Launchpad/Installer/LibraryInstaller.ahk

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ class LibraryInstaller extends InstallerBase {
44
version := "latest"
55

66
__New(appState, cache, tmpDir := "") {
7-
assets := []
8-
asset := GitHubReleaseInstallerAsset.new("VolantisDev/Launchpad", "LaunchpadLib.zip", true, "Lib", appState, "LibDirs", cache, "Libraries", true, tmpDir, true)
9-
asset.version := this.version
10-
assets.Push(asset)
11-
super.__New(appState, "Libraries", cache, assets, tmpDir)
7+
components := []
8+
component := GitHubReleaseInstallerComponent.new("VolantisDev/Launchpad", "LaunchpadLib.zip", true, "Lib", appState, "LibDirs", cache, "Libraries", true, tmpDir, true)
9+
component.version := this.version
10+
components.Push(component)
11+
super.__New(appState, "Libraries", cache, components, tmpDir)
1212
}
1313
}

Lib/Launchpad/Installer/ThemeInstaller.ahk

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ class ThemeInstaller extends InstallerBase {
33
version := "latest"
44

55
__New(appState, cache, downloadThemes := "", tmpDir := "") {
6-
assets := []
6+
components := []
77

8-
asset := GitHubReleaseInstallerAsset.new("VolantisDev/Launchpad", "LaunchpadThemes.zip", true, "Themes", appState, "LaunchpadThemes", cache, "Themes", true, tmpDir, true)
9-
asset.version := this.version
10-
assets.Push(asset)
8+
component := GitHubReleaseInstallerComponent.new("VolantisDev/Launchpad", "LaunchpadThemes.zip", true, "Themes", appState, "LaunchpadThemes", cache, "Themes", true, tmpDir, true)
9+
component.version := this.version
10+
components.Push(component)
1111

1212
if (downloadThemes != "") {
1313
for key, url in downloadThemes {
1414
path := "Themes\" . key . ".json"
15-
assets.Push(DownloadableInstallerAsset.new(url, false, path, appState, cache, key . "Theme", "Themes", false, tmpDir, false))
15+
components.Push(DownloadableInstallerComponent.new(url, false, path, appState, cache, key . "Theme", "Themes", false, tmpDir, false))
1616
}
1717
}
1818

19-
super.__New(appState, "Themes", cache, assets, tmpDir)
19+
super.__New(appState, "Themes", cache, components, tmpDir)
2020
}
2121
}

Lib/Launchpad/Service/InstallerManager.ahk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ class InstallerManager extends ServiceBase {
33

44
SetupInstallers() {
55
extraThemes := Map()
6-
extraDependencyAssets := []
6+
extraDependencyComponents := []
77

88
tmpDir := this.app.tmpDir . "\Installers"
99
cache := this.app.Cache.GetCache("file")
1010
this.SetInstaller("LaunchpadExe", LaunchpadExeInstaller.new(this.app.AppState, cache, tmpDir))
1111
this.SetInstaller("Launchpad", LaunchpadInstaller.new(this.app.AppState, cache, tmpDir))
1212
this.SetInstaller("Libraries", LibraryInstaller.new(this.app.AppState, cache, tmpDir))
1313
this.SetInstaller("Themes", ThemeInstaller.new(this.app.AppState, cache, extraThemes, tmpDir))
14-
this.SetInstaller("Dependencies", DependencyInstaller.new(this.app.AppState, cache, extraDependencyAssets, tmpDir))
14+
this.SetInstaller("Dependencies", DependencyInstaller.new(this.app.AppState, cache, extraDependencyComponents, tmpDir))
1515
}
1616

1717
GetInstaller(key) {

Lib/Launchpad/Service/ThemeManager.ahk

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,10 @@ class ThemeManager extends ServiceBase {
5050

5151
themeObj := ""
5252

53-
if (this.themes.Has(key)) {
54-
if (!this.ThemeIsLoaded(key)) {
55-
themeObj := this.LoadTheme(key)
56-
} else {
57-
themeObj := this.themes[key]
58-
}
53+
if (!this.ThemeIsLoaded(key)) {
54+
themeObj := this.LoadTheme(key)
55+
} else {
56+
themeObj := this.themes[key]
5957
}
6058

6159
return themeObj

Lib/Shared/Includes.ahk

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
#Include E:\Tools\Launchpad\Lib\Shared\HttpReq\HttpReqBase.ahk
2121
#Include E:\Tools\Launchpad\Lib\Shared\HttpReq\WinHttpReq.ahk
2222
#Include E:\Tools\Launchpad\Lib\Shared\Installer\InstallerBase.ahk
23-
#Include E:\Tools\Launchpad\Lib\Shared\InstallerAsset\DownloadableInstallerAsset.ahk
24-
#Include E:\Tools\Launchpad\Lib\Shared\InstallerAsset\FileInstallerAssetBase.ahk
25-
#Include E:\Tools\Launchpad\Lib\Shared\InstallerAsset\GitHubReleaseInstallerAsset.ahk
26-
#Include E:\Tools\Launchpad\Lib\Shared\InstallerAsset\InstallerAssetBase.ahk
27-
#Include E:\Tools\Launchpad\Lib\Shared\InstallerAsset\LibInstallerAsset.ahk
23+
#Include E:\Tools\Launchpad\Lib\Shared\InstallerComponent\DownloadableInstallerComponent.ahk
24+
#Include E:\Tools\Launchpad\Lib\Shared\InstallerComponent\FileInstallerComponentBase.ahk
25+
#Include E:\Tools\Launchpad\Lib\Shared\InstallerComponent\GitHubReleaseInstallerComponent.ahk
26+
#Include E:\Tools\Launchpad\Lib\Shared\InstallerComponent\InstallerComponentBase.ahk
27+
#Include E:\Tools\Launchpad\Lib\Shared\InstallerComponent\LibInstallerComponent.ahk
2828
#Include E:\Tools\Launchpad\Lib\Shared\Json\Json.ahk
2929
#Include E:\Tools\Launchpad\Lib\Shared\Notifier\NotifierBase.ahk
3030
#Include E:\Tools\Launchpad\Lib\Shared\Notifier\ToastNotifier.ahk

0 commit comments

Comments
 (0)