diff options
author | Dave Reisner <dreisner@archlinux.org> | 2015-03-26 21:43:45 -0400 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2015-03-26 21:43:45 -0400 |
commit | 78ef2f963dc9b0b0c5466ed9d84ea6f29d85db88 (patch) | |
tree | 03c8e62a79b2f8ca7da1fa0f90b5b34ce0b4a913 | |
parent | befcf12820411ace8d9531dc829abd20c957fe60 (diff) | |
download | mirror-ponymix-78ef2f963dc9b0b0c5466ed9d84ea6f29d85db88.tar.gz mirror-ponymix-78ef2f963dc9b0b0c5466ed9d84ea6f29d85db88.tar.bz2 mirror-ponymix-78ef2f963dc9b0b0c5466ed9d84ea6f29d85db88.zip |
Determine default opt_device after arg parsing
Fixes GHI#30.
-rw-r--r-- | ponymix.cc | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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) { |