@@ -6,7 +6,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"turtlesilicon/pkg/utils"
|
||||
"epochsilicon/pkg/utils"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/dialog"
|
||||
@@ -18,11 +18,12 @@ const DefaultCrossOverPath = "/Applications/CrossOver.app"
|
||||
|
||||
var (
|
||||
CrossoverPath string
|
||||
TurtlewowPath string
|
||||
PatchesAppliedTurtleWoW = false
|
||||
EpochPath string
|
||||
PatchesAppliedEpoch = false
|
||||
PatchesAppliedCrossOver = false
|
||||
RosettaX87ServiceRunning = false
|
||||
ServiceStarting = false
|
||||
DownloadingPatches = false
|
||||
)
|
||||
|
||||
func SelectCrossOverPath(myWindow fyne.Window, crossoverPathLabel *widget.RichText, updateAllStatuses func()) {
|
||||
@@ -53,35 +54,35 @@ func SelectCrossOverPath(myWindow fyne.Window, crossoverPathLabel *widget.RichTe
|
||||
}, myWindow)
|
||||
}
|
||||
|
||||
func SelectTurtleWoWPath(myWindow fyne.Window, turtlewowPathLabel *widget.RichText, updateAllStatuses func()) {
|
||||
func SelectEpochPath(myWindow fyne.Window, epochPathLabel *widget.RichText, updateAllStatuses func()) {
|
||||
dialog.ShowFolderOpen(func(uri fyne.ListableURI, err error) {
|
||||
if err != nil {
|
||||
dialog.ShowError(err, myWindow)
|
||||
return
|
||||
}
|
||||
if uri == nil {
|
||||
log.Println("TurtleWoW path selection cancelled.")
|
||||
log.Println("Epoch path selection cancelled.")
|
||||
updateAllStatuses()
|
||||
return
|
||||
}
|
||||
selectedPath := uri.Path()
|
||||
if utils.DirExists(selectedPath) {
|
||||
TurtlewowPath = selectedPath
|
||||
PatchesAppliedTurtleWoW = false
|
||||
log.Println("TurtleWoW path set to:", TurtlewowPath)
|
||||
EpochPath = selectedPath
|
||||
PatchesAppliedEpoch = false
|
||||
log.Println("Epoch path set to:", EpochPath)
|
||||
// Save to prefs
|
||||
prefs, _ := utils.LoadPrefs()
|
||||
prefs.TurtleWoWPath = selectedPath
|
||||
prefs.EpochPath = selectedPath
|
||||
utils.SavePrefs(prefs)
|
||||
} else {
|
||||
dialog.ShowError(fmt.Errorf("invalid selection: '%s' is not a valid directory", selectedPath), myWindow)
|
||||
log.Println("Invalid TurtleWoW path selected:", selectedPath)
|
||||
log.Println("Invalid Epoch path selected:", selectedPath)
|
||||
}
|
||||
updateAllStatuses()
|
||||
}, myWindow)
|
||||
}
|
||||
|
||||
func UpdatePathLabels(crossoverPathLabel, turtlewowPathLabel *widget.RichText) {
|
||||
func UpdatePathLabels(crossoverPathLabel, EpochPathLabel *widget.RichText) {
|
||||
if CrossoverPath == "" {
|
||||
crossoverPathLabel.Segments = []widget.RichTextSegment{&widget.TextSegment{Text: "Not set", Style: widget.RichTextStyle{ColorName: theme.ColorNameError}}}
|
||||
} else {
|
||||
@@ -89,12 +90,12 @@ func UpdatePathLabels(crossoverPathLabel, turtlewowPathLabel *widget.RichText) {
|
||||
}
|
||||
crossoverPathLabel.Refresh()
|
||||
|
||||
if TurtlewowPath == "" {
|
||||
turtlewowPathLabel.Segments = []widget.RichTextSegment{&widget.TextSegment{Text: "Not set", Style: widget.RichTextStyle{ColorName: theme.ColorNameError}}}
|
||||
if EpochPath == "" {
|
||||
EpochPathLabel.Segments = []widget.RichTextSegment{&widget.TextSegment{Text: "Not set", Style: widget.RichTextStyle{ColorName: theme.ColorNameError}}}
|
||||
} else {
|
||||
turtlewowPathLabel.Segments = []widget.RichTextSegment{&widget.TextSegment{Text: TurtlewowPath, Style: widget.RichTextStyle{ColorName: theme.ColorNameSuccess}}}
|
||||
EpochPathLabel.Segments = []widget.RichTextSegment{&widget.TextSegment{Text: EpochPath, Style: widget.RichTextStyle{ColorName: theme.ColorNameSuccess}}}
|
||||
}
|
||||
turtlewowPathLabel.Refresh()
|
||||
EpochPathLabel.Refresh()
|
||||
}
|
||||
|
||||
func CheckDefaultCrossOverPath() {
|
||||
|
Reference in New Issue
Block a user