mirror of
https://forge.fsky.io/oneflux/omegafox.git
synced 2026-02-11 05:42:03 -08:00
Fix launcher issues on macos #7
Fixes properties.json path not being found.
This commit is contained in:
parent
598a8566e2
commit
662e62fb2c
2 changed files with 11 additions and 3 deletions
|
|
@ -115,7 +115,7 @@ func parseJson(argv string, target interface{}) {
|
||||||
if fileExists(argv) {
|
if fileExists(argv) {
|
||||||
data, err = os.ReadFile(argv)
|
data, err = os.ReadFile(argv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Error reading config file: %v\n", err)
|
fmt.Printf("Error reading JSON file: %v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -124,7 +124,7 @@ func parseJson(argv string, target interface{}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := json.Unmarshal(data, target); err != nil {
|
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)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Property struct {
|
type Property struct {
|
||||||
|
|
@ -36,8 +37,15 @@ func validateConfig(configMap map[string]interface{}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadProperties() []Property {
|
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
|
var properties []Property
|
||||||
|
// Parse the JSON file
|
||||||
parseJson(propertiesPath, &properties)
|
parseJson(propertiesPath, &properties)
|
||||||
return properties
|
return properties
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue