SPM/register_unix.go

37 lines
922 B
Go

// run_default.go
//go:build !windows
// +build !windows
package spm
import (
"fmt"
"os"
"path/filepath"
)
// RegisterApp is not supported on non-Windows platforms.
func RegisterApp() error {
return fmt.Errorf("[WARN] RegisterApp() is only available on Windows")
}
// UnregisterApp is not supported on non-Windows platforms.
func UnregisterApp() error {
return fmt.Errorf("[WARN] 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
}