]> git.xonotic.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)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 12 Jun 2011 19:59:24 +0000 (19:59 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11194 d7cf8633-e32d-0410-b094-e92efae38249

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);
+}
+
 
 /*
 ===============