summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 842b903)
raw | patch | inline | side by side (parent: 842b903)
author | Max Kellermann <max@duempel.org> | |
Mon, 14 Jul 2014 09:24:27 +0000 (11:24 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Mon, 14 Jul 2014 09:26:09 +0000 (11:26 +0200) |
NEWS | patch | blob | history | |
src/screen_keydef.c | patch | blob | history |
index 187b72cee70d5d9f982fdc62c01c8249e665acfc..be63b36cf96418927687d6883d5236aa178a83c7 100644 (file)
--- a/NEWS
+++ b/NEWS
ncmpc 0.24 - not yet released
* fix crash on "jump" (hotkey ".")
+* save keys to path specified by --key-file
ncmpc 0.23 - (2014-07-10)
diff --git a/src/screen_keydef.c b/src/screen_keydef.c
index b947dd8f0ebf022634efedfa9781bb4fa5bfe94f..c89437e03e90f98914fa3ff7028501fc7e34848c 100644 (file)
--- a/src/screen_keydef.c
+++ b/src/screen_keydef.c
#include "conf.h"
#include "screen.h"
#include "screen_utils.h"
+#include "options.h"
#include "Compiler.h"
#include <assert.h>
static int
save_keys(void)
{
- if (!check_user_conf_dir()) {
- screen_status_printf(_("Error: Unable to create directory ~/.ncmpc - %s"),
- strerror(errno));
- screen_bell();
- return -1;
+ char *allocated = NULL;
+ const char *filename = options.key_file;
+ if (filename == NULL) {
+ if (!check_user_conf_dir()) {
+ screen_status_printf(_("Error: Unable to create directory ~/.ncmpc - %s"),
+ strerror(errno));
+ screen_bell();
+ return -1;
+ }
+
+ filename = allocated = build_user_key_binding_filename();
}
- char *filename = build_user_key_binding_filename();
FILE *f = fopen(filename, "w");
if (f == NULL) {
screen_status_printf(_("Error: %s - %s"), filename, strerror(errno));
screen_bell();
- g_free(filename);
+ g_free(allocated);
return -1;
}
else
screen_status_printf(_("Error: %s - %s"), filename, strerror(errno));
- g_free(filename);
+ g_free(allocated);
return fclose(f);
}