changeset 9926:ad429d617df4

allow config file loading outside of cygwin environment
author faust3
date Fri, 18 Apr 2003 18:17:05 +0000
parents 420640a0f6d0
children ea1274e658b4
files get_path.c
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/get_path.c	Fri Apr 18 13:18:59 2003 +0000
+++ b/get_path.c	Fri Apr 18 18:17:05 2003 +0000
@@ -2,11 +2,27 @@
 char *get_path(char *filename){
 	char *homedir;
 	char *buff;
+#if defined(__MINGW32__)||defined(__CYGWIN__)
+    static char *config_dir = "/mplayer";
+#else
 	static char *config_dir = "/.mplayer";
+#endif
 	int len;
 
 	if ((homedir = getenv("HOME")) == NULL)
+#if defined(__MINGW32__)||defined(__CYGWIN__) /*hack to get fonts etc. loaded outside of cygwin environment*/
+	{
+    	int __stdcall GetModuleFileNameA(void* hModule,char* lpFilename,int nSize);
+        int i,imax=0;       
+        char exedir[MAX_PATH];       
+        GetModuleFileNameA(NULL, exedir, MAX_PATH);
+        for(i=0; i< strlen(exedir);i++)if(exedir[i] =='\\'){exedir[i]='/';imax=i;}
+        exedir[imax]='\0';
+	    homedir = exedir;
+	}
+#else
 		return NULL;
+#endif       
 	len = strlen(homedir) + strlen(config_dir) + 1;
 	if (filename == NULL) {
 		if ((buff = (char *) malloc(len)) == NULL)