#At file:///C:/work/wex/absv2/ based on revid:iggy.galarza@stripped
37 Reggie Burnett 2012-09-17
added a small method to return files in a dir that match a regex
modified:
AbsUtility/ProductFile.cs
AbsUtility/Utility.cs
=== modified file 'AbsUtility/ProductFile.cs'
=== modified file 'AbsUtility/ProductFile.cs'
--- a/AbsUtility/ProductFile.cs 2012-09-17 21:54:48 +0000
+++ b/AbsUtility/ProductFile.cs 2012-09-17 22:01:12 +0000
@@ -52,7 +52,7 @@
throw new Exception("Every product file requires a regular expression");
if (Generated && String.IsNullOrEmpty(GenerationScript))
throw new Exception("Generated files require a supplied generation script");
- string[] files = Directory.GetFiles(Product.IncomingFolder, RegularExpression);
+ string[] files = Utility.MatchFiles(Product.IncomingFolder, RegularExpression);
if (files.Length != 1 && checkGenerated)
throw new Exception("Regular expression did not match exactly 1 file");
File = files[0];
=== modified file 'AbsUtility/Utility.cs'
--- a/AbsUtility/Utility.cs 2012-09-17 20:04:19 +0000
+++ b/AbsUtility/Utility.cs 2012-09-17 22:01:12 +0000
@@ -181,5 +181,19 @@
}
return !File.Exists(stoppedFile);
}
+
+ public static string[] MatchFiles(string dir, string regexPattern)
+ {
+ List<string> fileList = new List<string>();
+
+ Regex regex = new Regex(regexPattern);
+ string[] files = Directory.GetFiles(dir);
+ foreach (string file in files)
+ {
+ if (regex.Match(file).Success)
+ fileList.Add(file);
+ }
+ return fileList.ToArray();
+ }
}
}
Attachment: [text/bzr-bundle] bzr/reggie.burnett@oracle.com-20120917220112-uily5miqfn0h3hzp.bundle
| Thread |
|---|
| • bzr commit into ABSv2 branch (reggie.burnett:37) | Reggie Burnett | 19 Sep |