diff options
author | Kalle Wallin <kaw@linux.se> | 2004-04-19 22:10:13 +0000 |
---|---|---|
committer | Kalle Wallin <kaw@linux.se> | 2004-04-19 22:10:13 +0000 |
commit | 230b0fe73ac3a07293d495e895207b43cdfb3369 (patch) | |
tree | d24f5d8f3155948e13800ee3369808279b23a92b /conf.c | |
parent | bf28b56f26bb5753c706e2e249265f95b500fd78 (diff) | |
download | mpd-230b0fe73ac3a07293d495e895207b43cdfb3369.tar.gz mpd-230b0fe73ac3a07293d495e895207b43cdfb3369.tar.xz mpd-230b0fe73ac3a07293d495e895207b43cdfb3369.zip |
Added copyright notice and license notice
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@833 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | conf.c | 43 |
1 files changed, 41 insertions, 2 deletions
@@ -1,3 +1,21 @@ +/* + * (c) 2004 by Kalle Wallin (kaw@linux.se) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + #include <ctype.h> #include <stdio.h> #include <errno.h> @@ -384,6 +402,28 @@ read_rc_file(char *filename, options_t *options) return 0; } +int +check_user_conf_dir(void) +{ + int retval; + char *dirname = g_build_filename(g_get_home_dir(), "." PACKAGE, NULL); + + if( g_file_test(dirname, G_FILE_TEST_IS_DIR) ) + { + g_free(dirname); + return 0; + } + retval = mkdir(dirname, 0755); + g_free(dirname); + return retval; +} + +char * +get_user_key_binding_filename(void) +{ + return g_build_filename(g_get_home_dir(), "." PACKAGE, "keys", NULL); +} + int read_configuration(options_t *options) @@ -418,7 +458,7 @@ read_configuration(options_t *options) } /* check for user key bindings ~/.ncmpc/keys */ - filename = g_build_filename(g_get_home_dir(), "." PACKAGE, "keys", NULL); + filename = get_user_key_binding_filename(); if( !g_file_test(filename, G_FILE_TEST_IS_REGULAR) ) { g_free(filename); @@ -442,7 +482,6 @@ read_configuration(options_t *options) read_rc_file(filename, options); g_free(filename); filename = NULL; - //write_key_bindings(stderr); } return 0; |