Settings: expand tilde to home directory in several more variables

This commit is contained in:
Andrzej Rybczak
2016-10-30 19:21:46 +01:00
parent 67d4a04183
commit ee040635d9
2 changed files with 13 additions and 6 deletions

1
NEWS
View File

@@ -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.

View File

@@ -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 <typename ValueT, typename TransformT>
option_parser::worker buffer(NC::Buffer &arg, ValueT &&value, TransformT &&map)
@@ -237,8 +243,8 @@ bool Configuration::read(const std::vector<std::string> &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<std::string>(
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<std::string> &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<std::string>(
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<std::string> &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<std::string>(
external_editor, "nano", adjust_path
));
p.add("use_console_editor", yes_no(
use_console_editor, true