annotate get_path.c @ 12552:e58d894d570b

removing unused parts
author alex
date Thu, 10 Jun 2004 14:45:20 +0000
parents 133e0ebde74d
children 54ea3d6e657c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2557
6a74454ea121 some cleanup
arpi
parents:
diff changeset
1
6a74454ea121 some cleanup
arpi
parents:
diff changeset
2 char *get_path(char *filename){
6a74454ea121 some cleanup
arpi
parents:
diff changeset
3 char *homedir;
6a74454ea121 some cleanup
arpi
parents:
diff changeset
4 char *buff;
10026
b8780122e043 Cygwin should behave like a Unix environment, i.e. config files should be
diego
parents: 9929
diff changeset
5 #if defined(__MINGW32__)
9926
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
6 static char *config_dir = "/mplayer";
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
7 #else
2557
6a74454ea121 some cleanup
arpi
parents:
diff changeset
8 static char *config_dir = "/.mplayer";
9926
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
9 #endif
2557
6a74454ea121 some cleanup
arpi
parents:
diff changeset
10 int len;
6a74454ea121 some cleanup
arpi
parents:
diff changeset
11
6a74454ea121 some cleanup
arpi
parents:
diff changeset
12 if ((homedir = getenv("HOME")) == NULL)
9926
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
13 #if defined(__MINGW32__)||defined(__CYGWIN__) /*hack to get fonts etc. loaded outside of cygwin environment*/
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
14 {
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
15 int i,imax=0;
9929
faust3
parents: 9926
diff changeset
16 char exedir[260];
faust3
parents: 9926
diff changeset
17 GetModuleFileNameA(NULL, exedir, 260);
9926
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
18 for(i=0; i< strlen(exedir);i++)if(exedir[i] =='\\'){exedir[i]='/';imax=i;}
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
19 exedir[imax]='\0';
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
20 homedir = exedir;
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
21 }
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
22 #else
2557
6a74454ea121 some cleanup
arpi
parents:
diff changeset
23 return NULL;
9926
ad429d617df4 allow config file loading outside of cygwin environment
faust3
parents: 3746
diff changeset
24 #endif
2557
6a74454ea121 some cleanup
arpi
parents:
diff changeset
25 len = strlen(homedir) + strlen(config_dir) + 1;
6a74454ea121 some cleanup
arpi
parents:
diff changeset
26 if (filename == NULL) {
6a74454ea121 some cleanup
arpi
parents:
diff changeset
27 if ((buff = (char *) malloc(len)) == NULL)
6a74454ea121 some cleanup
arpi
parents:
diff changeset
28 return NULL;
6a74454ea121 some cleanup
arpi
parents:
diff changeset
29 sprintf(buff, "%s%s", homedir, config_dir);
6a74454ea121 some cleanup
arpi
parents:
diff changeset
30 } else {
6a74454ea121 some cleanup
arpi
parents:
diff changeset
31 len += strlen(filename) + 1;
6a74454ea121 some cleanup
arpi
parents:
diff changeset
32 if ((buff = (char *) malloc(len)) == NULL)
6a74454ea121 some cleanup
arpi
parents:
diff changeset
33 return NULL;
6a74454ea121 some cleanup
arpi
parents:
diff changeset
34 sprintf(buff, "%s%s/%s", homedir, config_dir, filename);
6a74454ea121 some cleanup
arpi
parents:
diff changeset
35 }
3746
d21bae2028a6 some debugging
arpi
parents: 2557
diff changeset
36 mp_msg(MSGT_GLOBAL,MSGL_V,"get_path('%s') -> '%s'\n",filename,buff);
2557
6a74454ea121 some cleanup
arpi
parents:
diff changeset
37 return buff;
6a74454ea121 some cleanup
arpi
parents:
diff changeset
38 }