]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
make "exec" accept wildcards
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 12 Jun 2011 19:59:24 +0000 (19:59 +0000)
committerRudolf Polzer <divverent@xonotic.org>
Mon, 13 Jun 2011 17:25:44 +0000 (19:25 +0200)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11194 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=adbccd5c89a88e85b2a9e8f9e93120c171e01a6e

cmd.c

diff --git a/cmd.c b/cmd.c
index a395eed658b9a65d8c95517ed3fb53e0820de83a..bbaca649369e1e5be7b88e3251d019894db88ce0 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -450,24 +450,10 @@ void Cmd_StuffCmds_f (void)
        Cbuf_InsertText (build);
 }
 
-
-/*
-===============
-Cmd_Exec_f
-===============
-*/
-static void Cmd_Exec_f (void)
+static void Cmd_Exec(const char *filename)
 {
        char *f;
-       const char *filename;
-
-       if (Cmd_Argc () != 2)
-       {
-               Con_Print("exec <filename> : execute a script file\n");
-               return;
-       }
 
-       filename = Cmd_Argv(1);
        if (!strcmp(filename, "config.cfg"))
        {
                filename = CONFIGFILENAME;
@@ -514,6 +500,35 @@ static void Cmd_Exec_f (void)
                Cbuf_InsertText("\nr_shadow_gloss 2\nr_shadow_bumpscale_basetexture 4\n\n");
 }
 
+/*
+===============
+Cmd_Exec_f
+===============
+*/
+static void Cmd_Exec_f (void)
+{
+       fssearch_t *s;
+       int i;
+
+       if (Cmd_Argc () != 2)
+       {
+               Con_Print("exec <filename> : execute a script file\n");
+               return;
+       }
+
+       s = FS_Search(Cmd_Argv(1), true, true);
+       if(!s || !s->numfilenames)
+       {
+               Con_Printf("couldn't exec %s\n",Cmd_Argv(1));
+               return;
+       }
+
+       for(i = 0; i < s->numfilenames; ++i)
+               Cmd_Exec(s->filenames[i]);
+
+       FS_FreeSearch(s);
+}
+
 
 /*
 ===============