Index: branches/pap/ppSim/src/ppSimSequenceDark.c
===================================================================
--- branches/pap/ppSim/src/ppSimSequenceDark.c	(revision 27708)
+++ branches/pap/ppSim/src/ppSimSequenceDark.c	(revision 28003)
@@ -1,5 +1,5 @@
 # include "ppSimSequence.h"
 
-bool ppSimSequenceDark (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, const char *ppSimCommand, const char *injectCommand) {
+bool ppSimSequenceDark (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, setRate;
@@ -39,5 +39,5 @@
 
 	    psStringAppend (&command, "%s -type DARK", ppSimCommand);
-      
+          
 	    if (setRate) {
 		double frnd = psRandomUniform(rng);
@@ -52,15 +52,19 @@
 	    fprintf (simfile, "%s\n", command);
 	    psFree (command);
-			    
+			        
 	    // 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 ++;
+        }
     }
     return true;
