diff --git a/installer.go b/installer.go index 00cb482..33d4787 100644 --- a/installer.go +++ b/installer.go @@ -67,8 +67,7 @@ func (inst *Installer) StartDownloadDecompress() { // 3) Decompress spm.UpdateProgress(0, "Decompressing...") - packagePath := filepath.Join(inst.DownloadDir, "browser-amd64-nightly-linux.tar.gz") - tempDir, err := spm.DecompressToTemp(packagePath) + tempDir, err := spm.DecompressPackage(inst.DownloadDir) if err != nil { inst.LastError = err return diff --git a/main.go b/main.go index 04a1698..f79b3d0 100644 --- a/main.go +++ b/main.go @@ -30,6 +30,9 @@ const finalStep = 3 func main() { monitor := rl.GetCurrentMonitor() + if monitor < 0 { + monitor = 0 // Fallback to the primary monitor + } screenW := rl.GetMonitorWidth(monitor) screenH := rl.GetMonitorHeight(monitor) diff --git a/spm/utils.go b/spm/utils.go index b71ba27..666cabe 100644 --- a/spm/utils.go +++ b/spm/utils.go @@ -62,3 +62,10 @@ func GetDefaultInstallDir() (string, error) { return installDir, nil } + +// DecompressPackage determines the appropriate package format and decompresses it. +func DecompressPackage(downloadDir string) (string, error) { + osName := runtime.GOOS + packagePath := filepath.Join(downloadDir, fmt.Sprintf("browser-amd64-nightly-%s.tar.gz", osName)) // If file naming changes this will break!! + return DecompressToTemp(packagePath) +}