Skip to content

Commit

Permalink
Fix launcher issues on macos #7
Browse files Browse the repository at this point in the history
Fixes properties.json path not being found.
  • Loading branch information
daijro committed Sep 12, 2024
1 parent 598a856 commit 662e62f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions launcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func parseJson(argv string, target interface{}) {
if fileExists(argv) {
data, err = os.ReadFile(argv)
if err != nil {
fmt.Printf("Error reading config file: %v\n", err)
fmt.Printf("Error reading JSON file: %v\n", err)
os.Exit(1)
}
} else {
Expand All @@ -124,7 +124,7 @@ func parseJson(argv string, target interface{}) {
}

if err := json.Unmarshal(data, target); err != nil {
fmt.Printf("Invalid JSON in config: %v\n", err)
fmt.Printf("Invalid JSON: %v\n", err)
os.Exit(1)
}
}
Expand Down
10 changes: 9 additions & 1 deletion launcher/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"math"
"os"
"reflect"
"runtime"
)

type Property struct {
Expand Down Expand Up @@ -36,8 +37,15 @@ func validateConfig(configMap map[string]interface{}) {
}

func loadProperties() []Property {
propertiesPath := getPath("properties.json")
// Get the path to the properties.json file
var propertiesPath string
if normalizeOS(runtime.GOOS) == "macos" {
propertiesPath = getPath("Camoufox.app/Contents/Resources/properties.json")
} else {
propertiesPath = getPath("properties.json")
}
var properties []Property
// Parse the JSON file
parseJson(propertiesPath, &properties)
return properties
}
Expand Down

0 comments on commit 662e62f

Please sign in to comment.