This commit is contained in:
partisan 2025-03-01 17:59:26 +01:00
parent 66f4191c5f
commit 44d20eb983
10 changed files with 319 additions and 72 deletions

View file

@ -4,7 +4,11 @@
package spm
import "fmt"
import (
"fmt"
"os"
"path/filepath"
)
// RegisterApp is not supported on non-Windows platforms.
func RegisterApp() error {
@ -15,3 +19,19 @@ func RegisterApp() error {
func UnregisterApp() error {
return fmt.Errorf("UnregisterApp is only available on Windows")
}
// IsRegistered returns true if the application is detected as installed.
// On Linux, we assume it is installed if the main executable exists in the install directory.
func IsRegistered() bool {
installDir, err := GetInstallDir()
if err != nil {
return false
}
// Assume the executable is named "spitfire" and is located in installDir.
exePath := filepath.Join(installDir, "browser", "spitfire")
if _, err := os.Stat(exePath); err == nil {
return true
}
return false
}