diff options
author | cboesch <cboesch@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-12-04 10:24:42 +0000 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-12-16 05:27:13 +0200 |
commit | 920d0976e7f657b34804b39bfbb4785fd24a76f0 (patch) | |
tree | ddcb7bf19966dc8d22bd3c0812f04b98cfd19085 /mplayer.c | |
parent | 9e35edf08bcb1b5b5d50a6860d133669fa184673 (diff) | |
download | mpv-920d0976e7f657b34804b39bfbb4785fd24a76f0.tar.bz2 mpv-920d0976e7f657b34804b39bfbb4785fd24a76f0.tar.xz |
Change some filename-handling code to use mp_basename()
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32675 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mplayer.c')
-rw-r--r-- | mplayer.c | 25 |
1 files changed, 3 insertions, 22 deletions
@@ -1013,7 +1013,7 @@ static void load_per_file_config (m_config_t* conf, const char *const file) { char *confpath; char cfg[PATH_MAX]; - char *name; + const char *name; if (strlen(file) > PATH_MAX - 14) { mp_msg(MSGT_CPLAYER, MSGL_WARN, "Filename is too long, can not load file or directory specific config files\n"); @@ -1021,20 +1021,7 @@ static void load_per_file_config (m_config_t* conf, const char *const file) } sprintf (cfg, "%s.conf", file); - name = strrchr(cfg, '/'); - if (HAVE_DOS_PATHS) { - char *tmp = strrchr(cfg, '\\'); - if (!name || tmp > name) - name = tmp; - tmp = strrchr(cfg, ':'); - if (!name || tmp > name) - name = tmp; - } - if (!name) - name = cfg; - else - name++; - + name = mp_basename(cfg); if (use_filedir_conf) { char dircfg[PATH_MAX]; strcpy(dircfg, cfg); @@ -3695,14 +3682,8 @@ if (edl_output_filename) { vo_vobsub=vobsub_open(buf,spudec_ifo,0,&vo_spudec); /* try from ~/.mplayer/sub */ if(!vo_vobsub && (psub = get_path( "sub/" ))) { - char *bname; + const char *bname = mp_basename(buf); int l; - bname = strrchr(buf,'/'); -#if defined(__MINGW32__) || defined(__CYGWIN__) - if(!bname) bname = strrchr(buf,'\\'); -#endif - if(bname) bname++; - else bname = buf; l = strlen(psub) + strlen(bname) + 1; psub = realloc(psub,l); strcat(psub,bname); |