From ee040635d96ae04bc5af3262127fe34edc8ab96b Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Sun, 30 Oct 2016 19:21:46 +0100 Subject: [PATCH] Settings: expand tilde to home directory in several more variables --- NEWS | 1 + src/settings.cpp | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index fcfe6bd6..a6457133 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ ncmpcpp-0.7.6 (????-??-??) * Make sure that stream of random numbers is not deterministic. * Opening playlist editor when there is no MPD playlists directory no longer freezes the application. * Added info about behavior of MPD_HOST and MPD_PORT environment variables to man page. +* Tile will now be expanded to home directory in visualizer_fifo_path, execute_on_song_change and external_editor configuration variables. ncmpcpp-0.7.5 (2016-08-17) * Action chains can be now used for seeking. diff --git a/src/settings.cpp b/src/settings.cpp index 79646e5f..6991fa76 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -160,6 +160,12 @@ std::string adjust_directory(std::string s) return s; } +std::string adjust_path(std::string s) +{ + expand_home(s); + return s; +} + // parser worker for buffer template option_parser::worker buffer(NC::Buffer &arg, ValueT &&value, TransformT &&map) @@ -237,8 +243,8 @@ bool Configuration::read(const std::vector &config_paths, bool igno p.add("mpd_crossfade_time", assign_default( crossfade_time, 5 )); - p.add("visualizer_fifo_path", assign_default( - visualizer_fifo_path, "/tmp/mpd.fifo" + p.add("visualizer_fifo_path", assign_default( + visualizer_fifo_path, "/tmp/mpd.fifo", adjust_path )); p.add("visualizer_output_name", assign_default( visualizer_output_name, "Visualizer feed" @@ -372,8 +378,8 @@ bool Configuration::read(const std::vector &config_paths, bool igno song_columns_mode_format = columns_to_format(columns); return v; })); - p.add("execute_on_song_change", assign_default( - execute_on_song_change, "" + p.add("execute_on_song_change", assign_default( + execute_on_song_change, "", adjust_path )); p.add("playlist_show_mpd_host", yes_no( playlist_show_mpd_host, false @@ -641,8 +647,8 @@ bool Configuration::read(const std::vector &config_paths, bool igno boundsCheck(v, 1u, 3u); return --v; })); - p.add("external_editor", assign_default( - external_editor, "nano" + p.add("external_editor", assign_default( + external_editor, "nano", adjust_path )); p.add("use_console_editor", yes_no( use_console_editor, true