@@ -1,8 +1,8 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"epochsilicon/pkg/log"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@@ -74,7 +74,7 @@ reg add "%s" /v "RightOptionIsAlt" /t REG_SZ /d "Y" /f
|
||||
return fmt.Errorf("batch registry add failed: %v, output: %s", err, string(output))
|
||||
}
|
||||
|
||||
log.Printf("Successfully enabled Option-as-Alt mapping in Wine registry (optimized)")
|
||||
log.Infof("Successfully enabled Option-as-Alt mapping in Wine registry (optimized)")
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ reg delete "%s" /v "RightOptionIsAlt" /f 2>nul
|
||||
return fmt.Errorf("batch registry delete failed: %v, output: %s", err, string(output))
|
||||
}
|
||||
|
||||
log.Printf("Successfully disabled Option-as-Alt mapping in Wine registry (optimized)")
|
||||
log.Infof("Successfully disabled Option-as-Alt mapping in Wine registry (optimized)")
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ reg delete "%s" /v "RightOptionIsAlt" /f 2>nul
|
||||
func CheckOptionAsAltEnabled() bool {
|
||||
homeDir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
log.Printf("Failed to get user home directory: %v", err)
|
||||
log.Infof("Failed to get user home directory: %v", err)
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ func CheckOptionAsAltEnabled() bool {
|
||||
|
||||
// Check if CrossOver wine loader exists
|
||||
if !PathExists(wineLoaderPath) {
|
||||
log.Printf("CrossOver wine loader not found at: %s", wineLoaderPath)
|
||||
log.Infof("CrossOver wine loader not found at: %s", wineLoaderPath)
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -133,18 +133,18 @@ func CheckOptionAsAltEnabled() bool {
|
||||
func CheckOptionAsAltEnabledFast() bool {
|
||||
regPath, err := GetWineUserRegPath()
|
||||
if err != nil {
|
||||
log.Printf("Failed to get Wine registry path: %v", err)
|
||||
log.Infof("Failed to get Wine registry path: %v", err)
|
||||
return false
|
||||
}
|
||||
|
||||
if !PathExists(regPath) {
|
||||
log.Printf("Wine user.reg file not found at: %s", regPath)
|
||||
log.Infof("Wine user.reg file not found at: %s", regPath)
|
||||
return false
|
||||
}
|
||||
|
||||
content, err := os.ReadFile(regPath)
|
||||
if err != nil {
|
||||
log.Printf("Failed to read Wine registry file: %v", err)
|
||||
log.Infof("Failed to read Wine registry file: %v", err)
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -191,12 +191,12 @@ func SetOptionAsAltEnabled(enabled bool) error {
|
||||
} else {
|
||||
err := setRegistryValuesOptimized(winePrefix, false)
|
||||
if err != nil {
|
||||
log.Printf("Wine registry disable failed: %v", err)
|
||||
log.Infof("Wine registry disable failed: %v", err)
|
||||
}
|
||||
|
||||
err2 := setRegistryValuesFast(false)
|
||||
if err2 != nil {
|
||||
log.Printf("File-based cleanup failed: %v", err2)
|
||||
log.Infof("File-based cleanup failed: %v", err2)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
@@ -334,7 +334,7 @@ func addOptionAsAltSettingsFast(regPath string, lines []string) error {
|
||||
return fmt.Errorf("failed to write registry file: %v", err)
|
||||
}
|
||||
|
||||
log.Printf("Successfully enabled Option-as-Alt mapping in Wine registry (fast method)")
|
||||
log.Infof("Successfully enabled Option-as-Alt mapping in Wine registry (fast method)")
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -342,7 +342,7 @@ func addOptionAsAltSettingsFast(regPath string, lines []string) error {
|
||||
func removeOptionAsAltSettingsFast(regPath string, lines []string) error {
|
||||
if !PathExists(regPath) {
|
||||
// File doesn't exist, nothing to remove
|
||||
log.Printf("Successfully disabled Option-as-Alt mapping in Wine registry (no file to modify)")
|
||||
log.Infof("Successfully disabled Option-as-Alt mapping in Wine registry (no file to modify)")
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -369,7 +369,7 @@ func removeOptionAsAltSettingsFast(regPath string, lines []string) error {
|
||||
return fmt.Errorf("failed to write registry file: %v", err)
|
||||
}
|
||||
|
||||
log.Printf("Successfully disabled Option-as-Alt mapping in Wine registry (fast method)")
|
||||
log.Infof("Successfully disabled Option-as-Alt mapping in Wine registry (fast method)")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user