From 78ef2f963dc9b0b0c5466ed9d84ea6f29d85db88 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Thu, 26 Mar 2015 21:43:45 -0400 Subject: Determine default opt_device after arg parsing Fixes GHI#30. --- ponymix.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ponymix.cc b/ponymix.cc index a07059d..5f1e98c 100644 --- a/ponymix.cc +++ b/ponymix.cc @@ -654,13 +654,17 @@ int main(int argc, char* argv[]) { ServerInfo defaults = ponymix.GetDefaults(); opt_action = "defaults"; opt_devtype = DEVTYPE_SINK; - opt_device = defaults.sink.c_str(); opt_maxvolume = 100; if (!parse_options(argc, argv)) return 1; argc -= optind; argv += optind; + // Do this after parsing such that we respect any changes to opt_devtype and + // explicit opt_device + if (opt_device == nullptr) + opt_device = defaults.GetDefault(opt_devtype).c_str(); + try { #ifdef HAVE_NOTIFY if (opt_notify) { -- cgit v1.2.3