@@ -41,11 +41,15 @@ import "C"
4141
4242import (
4343 "flag"
44+ "os"
45+ "runtime"
46+ "strings"
4447 "unsafe"
4548
4649 "github.com/digitalbitbox/bitbox-wallet-app/backend/bridgecommon"
4750 btctypes "github.com/digitalbitbox/bitbox-wallet-app/backend/coins/btc/types"
4851 "github.com/digitalbitbox/bitbox-wallet-app/backend/devices/usb"
52+ "github.com/digitalbitbox/bitbox-wallet-app/util/logging"
4953 "github.com/digitalbitbox/bitbox-wallet-app/util/system"
5054)
5155
@@ -76,11 +80,24 @@ func serve(
7680 responseCallback C.responseCallback ,
7781 notifyUserCallback C.notifyUserCallback ,
7882) {
83+ log := logging .Get ().WithGroup ("server" )
84+ log .WithField ("args" , os .Args ).Info ("Started Qt application" )
7985 // workaround: this flag is parsed by qtwebengine, but flag.Parse() quits the app on
8086 // unrecognized flags
8187 // _ = flag.Int("remote-debugging-port", 0, "")
8288 testnet := flag .Bool ("testnet" , false , "activate testnets" )
8389
90+ if runtime .GOOS == "darwin" {
91+ // eat "-psn_xxxx" on Mac, which is passed when starting an app from Finder for the first time.
92+ // See also: https://stackoverflow.com/questions/10242115/os-x-strange-psn-command-line-parameter-when-launched-from-finder
93+ for _ , arg := range os .Args [1 :] {
94+ trimmed := strings .TrimLeft (arg , "-" )
95+ if strings .HasPrefix (trimmed , "psn_" ) {
96+ flag .Bool (trimmed , false , "<ignored>" )
97+ }
98+ }
99+ }
100+
84101 gapLimitsReceive := flag .Uint ("gapLimitReceive" , 0 , "gap limit for receive addresses. Do not use this unless you know what this means." )
85102 gapLimitsChange := flag .Uint ("gapLimitChange" , 0 , "gap limit for change addresses. Do not use this unless you know what this means." )
86103
0 commit comments