added autodelete WDB option

This commit is contained in:
aomizu
2025-06-21 09:40:34 +09:00
parent 2abe296278
commit b2f92a8774
5 changed files with 32 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ import (
var EnableMetalHud = true // Default to enabled
var CustomEnvVars = "" // Custom environment variables
var EnableVanillaTweaks = false // Default to disabled
var AutoDeleteWdb = false // Default to disabled
// Terminal state management
var (
@@ -177,6 +178,22 @@ func continueLaunch(myWindow fyne.Window, wowExePath string) {
return
}
// Auto-delete WDB directory if enabled
if AutoDeleteWdb {
wdbPath := filepath.Join(paths.TurtlewowPath, "WDB")
if utils.DirExists(wdbPath) {
debug.Printf("Auto-deleting WDB directory: %s", wdbPath)
if err := os.RemoveAll(wdbPath); err != nil {
debug.Printf("Warning: failed to auto-delete WDB directory: %v", err)
// Don't block the launch, just log the error
} else {
debug.Printf("Successfully auto-deleted WDB directory")
}
} else {
debug.Printf("WDB directory not found, nothing to delete")
}
}
// Since RosettaX87 service is already running, we can directly launch WoW
debug.Println("RosettaX87 service is running. Proceeding to launch WoW.")

View File

@@ -49,6 +49,17 @@ func createOptionsComponents() {
vanillaTweaksCheckbox.SetChecked(prefs.EnableVanillaTweaks)
launcher.EnableVanillaTweaks = prefs.EnableVanillaTweaks
autoDeleteWdbCheckbox = widget.NewCheck("Auto-delete WDB directory on launch", func(checked bool) {
launcher.AutoDeleteWdb = checked
// Save to preferences
prefs, _ := utils.LoadPrefs()
prefs.AutoDeleteWdb = checked
utils.SavePrefs(prefs)
debug.Printf("Auto-delete WDB enabled: %v", launcher.AutoDeleteWdb)
})
autoDeleteWdbCheckbox.SetChecked(prefs.AutoDeleteWdb)
launcher.AutoDeleteWdb = prefs.AutoDeleteWdb
// Create recommended settings button with help icon
applyRecommendedSettingsButton = widget.NewButton("Apply recommended settings", func() {
err := launcher.ApplyRecommendedSettings()

View File

@@ -35,6 +35,7 @@ func showOptionsPopup() {
metalHudCheckbox,
showTerminalCheckbox,
vanillaTweaksCheckbox,
autoDeleteWdbCheckbox,
widget.NewSeparator(),
container.NewBorder(nil, nil, recommendedSettingsLabel, container.NewHBox(applyRecommendedSettingsButton, recommendedSettingsHelpButton), nil),
widget.NewSeparator(),
@@ -74,7 +75,7 @@ func showOptionsPopup() {
// Get the window size and calculate 2/3 size
windowSize := currentWindow.Content().Size()
popupWidth := windowSize.Width * 5 / 6
popupHeight := windowSize.Height * 5 / 6
popupHeight := windowSize.Height * 9 / 10
// Create a modal popup
popup := widget.NewModalPopUp(popupContent, currentWindow.Canvas())

View File

@@ -31,6 +31,7 @@ var (
metalHudCheckbox *widget.Check
showTerminalCheckbox *widget.Check
vanillaTweaksCheckbox *widget.Check
autoDeleteWdbCheckbox *widget.Check
// Recommended settings button
applyRecommendedSettingsButton *widget.Button

View File

@@ -15,6 +15,7 @@ type UserPrefs struct {
ShowTerminalNormally bool `json:"show_terminal_normally"`
EnableVanillaTweaks bool `json:"enable_vanilla_tweaks"`
RemapOptionAsAlt bool `json:"remap_option_as_alt"`
AutoDeleteWdb bool `json:"auto_delete_wdb"`
}
func getPrefsPath() (string, error) {