mirror of
https://github.com/clockworkpi/LauncherGoDev.git
synced 2025-12-12 07:58:51 +01:00
45 lines
1.0 KiB
Go
45 lines
1.0 KiB
Go
package UI
|
|
|
|
import (
|
|
"path/filepath"
|
|
)
|
|
|
|
type CommercialSoftwarePackage struct {
|
|
BinLocation string
|
|
MenuLocation string
|
|
}
|
|
|
|
func NewCommercialSoftwarePackage(b,m string) *CommercialSoftwarePackage{
|
|
return &CommercialSoftwarePackage{b,m}
|
|
}
|
|
|
|
func (self *CommercialSoftwarePackage) Init() {
|
|
|
|
script := filepath.Join(self.MenuLocation,"Setup.sh")
|
|
MakeExecutable(script)
|
|
script = filepath.Join(self.MenuLocation,"Run.sh")
|
|
MakeExecutable(script)
|
|
}
|
|
|
|
func (self *CommercialSoftwarePackage) IsInstalled() bool {
|
|
return FileExists(self.BinLocation)
|
|
}
|
|
|
|
func (self *CommercialSoftwarePackage) IsConfiged() bool {
|
|
return FileExists(filepath.Join(self.MenuLocation,".done"))
|
|
}
|
|
|
|
func (self *CommercialSoftwarePackage) GetRunScript() string {
|
|
return filepath.Join(self.MenuLocation,"Run.sh")
|
|
}
|
|
|
|
func (self *CommercialSoftwarePackage) RunSetup() {
|
|
if self.IsConfiged() == false {
|
|
script := filepath.Join(self.MenuLocation,"Setup.sh")
|
|
MakeExecutable(script)
|
|
System(script) /// Scripts with very short runtime
|
|
}
|
|
}
|
|
|
|
|