Signal handler messages moved to help_mp, so they can be translated
[mplayer/greg.git] / get_path.c
blob9d0c1096a3ddbcfdaf1a3bd97abeeac9e62161af
2 char *get_path(char *filename){
3 char *homedir;
4 char *buff;
5 static char *config_dir = "/.mplayer";
6 int len;
8 if ((homedir = getenv("HOME")) == NULL)
9 return NULL;
10 len = strlen(homedir) + strlen(config_dir) + 1;
11 if (filename == NULL) {
12 if ((buff = (char *) malloc(len)) == NULL)
13 return NULL;
14 sprintf(buff, "%s%s", homedir, config_dir);
15 } else {
16 len += strlen(filename) + 1;
17 if ((buff = (char *) malloc(len)) == NULL)
18 return NULL;
19 sprintf(buff, "%s%s/%s", homedir, config_dir, filename);
21 mp_msg(MSGT_GLOBAL,MSGL_V,"get_path('%s') -> '%s'\n",filename,buff);
22 return buff;