SPM/register_unix.go

38 lines
922 B
Go
Raw Normal View History

2025-02-25 20:15:39 +01:00
// run_default.go
//go:build !windows
// +build !windows
package spm
2025-03-01 17:59:26 +01:00
import (
"fmt"
"os"
"path/filepath"
)
2025-02-25 20:15:39 +01:00
// RegisterApp is not supported on non-Windows platforms.
func RegisterApp() error {
return fmt.Errorf("[WARN] RegisterApp() is only available on Windows")
2025-02-25 20:15:39 +01:00
}
// UnregisterApp is not supported on non-Windows platforms.
func UnregisterApp() error {
return fmt.Errorf("[WARN] UnregisterApp() is only available on Windows")
2025-02-25 20:15:39 +01:00
}
2025-03-01 17:59:26 +01:00
// 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
}