aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-02-13 19:51:27 +0100
committerMax Kellermann <max@duempel.org>2012-02-13 19:51:27 +0100
commit3b6790c7dc5994bce1b4dddf51871377ae46de6b (patch)
treef96788dca9443784ee6dcfb7639bba7b4f60d458
parent5ee3a9a9cad4436b99b56ea6336cbfa91fe7a967 (diff)
downloadmpd-3b6790c7dc5994bce1b4dddf51871377ae46de6b.tar.gz
mpd-3b6790c7dc5994bce1b4dddf51871377ae46de6b.tar.xz
mpd-3b6790c7dc5994bce1b4dddf51871377ae46de6b.zip
command: never print "bad name" in response to "load"
Work around a confusing error message.
-rw-r--r--src/command.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/command.c b/src/command.c
index 2737c34e9..854f16083 100644
--- a/src/command.c
+++ b/src/command.c
@@ -817,11 +817,20 @@ handle_load(struct client *client, int argc, char *argv[])
return print_playlist_result(client, result);
GError *error = NULL;
- return playlist_load_spl(&g_playlist, client->player_control,
- argv[1], start_index, end_index,
- &error)
- ? COMMAND_RETURN_OK
- : print_error(client, error);
+ if (playlist_load_spl(&g_playlist, client->player_control,
+ argv[1], start_index, end_index,
+ &error))
+ return COMMAND_RETURN_OK;
+
+ if (error->domain == playlist_quark() &&
+ error->code == PLAYLIST_RESULT_BAD_NAME)
+ /* the message for BAD_NAME is confusing when the
+ client wants to load a playlist file from the music
+ directory; patch the GError object to show "no such
+ playlist" instead */
+ error->code = PLAYLIST_RESULT_NO_SUCH_LIST;
+
+ return print_error(client, error);
}
static enum command_return