Index: trunk/ppSim/src/ppSimSequenceFlat.c
===================================================================
--- trunk/ppSim/src/ppSimSequenceFlat.c	(revision 19315)
+++ trunk/ppSim/src/ppSimSequenceFlat.c	(revision 27967)
@@ -1,5 +1,5 @@
 # include "ppSimSequence.h"
 
-bool ppSimSequenceFlat (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, const char *ppSimCommand, const char *injectCommand) {
+bool ppSimSequenceFlat (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, const char *ppSimCommand, const char *injectCommand, psArray *files) {
 
     bool status;
@@ -26,5 +26,5 @@
 	// loop over the filters & exposure times
 	for (int j = 0; j < nSetup; j++) {
-	    
+	        
 	    // define the output filename
 	    psString filename = NULL;
@@ -50,11 +50,15 @@
 	    // define the inject command
 	    // path should be dirname/filename
-	    command = psStringCopy (injectCommand);
-	    psStringAppend (&command, " %s*.fits",    filename);
-	    fprintf (inject, "%s\n", command);
-	    psFree (command);
-	    psFree (filename);
+	
+	    // we use the filename above (really the file root) to construct the filenames
+	    for (int i = 0; i < files->n; i++) {
+		command = psStringCopy (injectCommand);
+		psStringAppend (&command, " %s.%s", filename, (char *) files->data[i]);
+		fprintf (inject, "%s\n", command);
+		psFree (command);
+	    }
 
-	    nImage ++;
+            psFree (filename);
+            nImage ++;
 	}
     }
