diff options
author | Max Kellermann <max@duempel.org> | 2011-11-28 09:35:50 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-11-28 09:35:50 +0100 |
commit | cf15629aeae7b2f750388c6823f43cd5918676a4 (patch) | |
tree | 6222f0bb2e4af6a46bdd21dec9616949e88d8ccd /src | |
parent | a727d0bb0b2b3757a32c27caa1b794fe0b3ddf6b (diff) | |
download | mpd-cf15629aeae7b2f750388c6823f43cd5918676a4.tar.gz mpd-cf15629aeae7b2f750388c6823f43cd5918676a4.tar.xz mpd-cf15629aeae7b2f750388c6823f43cd5918676a4.zip |
mapper: move code to check_directory()
Diffstat (limited to 'src')
-rw-r--r-- | src/mapper.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/mapper.c b/src/mapper.c index 108de9531..426b2980f 100644 --- a/src/mapper.c +++ b/src/mapper.c @@ -52,24 +52,27 @@ strdup_chop_slash(const char *path_fs) } static void +check_directory(const char *path) +{ + if (!g_file_test(path, G_FILE_TEST_IS_DIR)) + g_warning("Not a directory: %s", path); +} + +static void mapper_set_music_dir(const char *path) { + check_directory(path); + music_dir = strdup_chop_slash(path); music_dir_length = strlen(music_dir); - - if (!g_file_test(music_dir, G_FILE_TEST_IS_DIR)) - g_warning("music directory is not a directory: \"%s\"", - music_dir); } static void mapper_set_playlist_dir(const char *path) { - playlist_dir = g_strdup(path); + check_directory(path); - if (!g_file_test(playlist_dir, G_FILE_TEST_IS_DIR)) - g_warning("playlist directory is not a directory: \"%s\"", - playlist_dir); + playlist_dir = g_strdup(path); } void mapper_init(const char *_music_dir, const char *_playlist_dir) |