changeset 29592:ccdfb20713eb

Add support for directory-specific mplayer.conf configuration file. Patch by Christian P. Schmidt "schmidt digadd de"
author reimar
date Wed, 02 Sep 2009 19:43:05 +0000
parents bd3ac7fc0a70
children 78bb10138aa4
files mplayer.c
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mplayer.c	Wed Sep 02 17:49:24 2009 +0000
+++ b/mplayer.c	Wed Sep 02 19:43:05 2009 +0000
@@ -48,6 +48,7 @@
 #include "cfg-mplayer-def.h"
 
 #include "libavutil/intreadwrite.h"
+#include "libavutil/avstring.h"
 
 #include "subreader.h"
 
@@ -935,9 +936,6 @@
 
     sprintf (cfg, "%s.conf", file);
 
-    if (use_filedir_conf && try_load_config(conf, cfg))
-	return;
-
     name = strrchr(cfg, '/');
     if (HAVE_DOS_PATHS) {
         char *tmp = strrchr(cfg, '\\');
@@ -952,6 +950,16 @@
     else
 	name++;
 
+    if (use_filedir_conf) {
+        char dircfg[strlen(file)+14];
+        strcpy(dircfg, cfg);
+        strcpy(dircfg + (name - cfg), "mplayer.conf");
+        try_load_config(conf, dircfg);
+
+        if (try_load_config(conf, cfg))
+            return;
+    }
+
     if ((confpath = get_path (name)) != NULL)
     {
 	try_load_config(conf, confpath);