view get_path.c @ 10578:b9d289fd8a57

10000l, the old code was slow as hell, copying stuff extra times and actually broken -- blanking the whole screen at each 'page flip' with -dr enabled. benchmarks: before: 56% cpu for decode 56% cpu for vo with no -dr 25% cpu for vo with -dr after: 56% cpu for decode 25% cpu for vo without -dr 0% cpu for vo with -dr if vo_fbdev is going to do pageflip, it needs to do it for REAL, using vertical scroll registers (like g2), not copying a temp buffer (which will shear anyway and is super-slow).
author rfelker
date Tue, 12 Aug 2003 08:24:24 +0000
parents b8780122e043
children 133e0ebde74d
line wrap: on
line source


char *get_path(char *filename){
	char *homedir;
	char *buff;
#if defined(__MINGW32__)
    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[260];       
        GetModuleFileNameA(NULL, exedir, 260);
        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)
			return NULL;
		sprintf(buff, "%s%s", homedir, config_dir);
	} else {
		len += strlen(filename) + 1;
		if ((buff = (char *) malloc(len)) == NULL)
			return NULL;
		sprintf(buff, "%s%s/%s", homedir, config_dir, filename);
	}
	mp_msg(MSGT_GLOBAL,MSGL_V,"get_path('%s') -> '%s'\n",filename,buff);
	return buff;
}