BinaryBuilder file pattern


#1

hi,

I had to convert some resource files from a directory containing a lot of other files and I didn’t wanted to copy them individually in a separate folder before runnning the converter.

So here is a very simple patch for BinaryBuilder.cpp that allows an optional file pattern argument to be given on the command line as a 4th argument.

Index: BinaryBuilder.cpp
===================================================================
--- BinaryBuilder.cpp	(revision 127)
+++ BinaryBuilder.cpp	(working copy)
@@ -84,7 +84,7 @@
 
     printf ("\n BinaryBuilder! Copyright 2007 by Julian Storer - www.rawmaterialsoftware.com\n\n");
 
-    if (argc != 4)
+    if (argc < 4)
     {
         printf (" Usage: BinaryBuilder  sourcedirectory targetdirectory targetclassname\n\n");
         printf (" BinaryBuilder will find all files in the source directory, and encode them\n");
@@ -135,8 +135,13 @@
 
     printf ((const char*) message);
 
+	String filePattern("*");
+
+	if(argc>=5)
+		filePattern = String(argv[4]);
+
     OwnedArray <File> files;
-    sourceDirectory.findChildFiles (files, File::findFiles, true, "*");
+    sourceDirectory.findChildFiles (files, File::findFiles, true, filePattern);
 
     if (files.size() == 0)
     {

#2

good idea, thanks!


#3