|
@@ -1,11 +1,14 @@
|
|
|
|
|
+using Invercargill;
|
|
|
|
|
+using Invercargill.DataStructures;
|
|
|
|
|
+
|
|
|
namespace Webmify {
|
|
namespace Webmify {
|
|
|
|
|
|
|
|
static string watch_dir;
|
|
static string watch_dir;
|
|
|
static string output_dir;
|
|
static string output_dir;
|
|
|
static string work_dir;
|
|
static string work_dir;
|
|
|
static uint workers;
|
|
static uint workers;
|
|
|
- static Invercargill.Set<string> processed_files;
|
|
|
|
|
- static Invercargill.Fifo<string> queue;
|
|
|
|
|
|
|
+ static HashSet<string> processed_files;
|
|
|
|
|
+ static Fifo<string> queue;
|
|
|
|
|
|
|
|
public static int main(string[] argv) {
|
|
public static int main(string[] argv) {
|
|
|
if(argv.length != 4 && argv.length != 5) {
|
|
if(argv.length != 4 && argv.length != 5) {
|
|
@@ -26,8 +29,8 @@ namespace Webmify {
|
|
|
return -2;
|
|
return -2;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- processed_files = new Invercargill.Set<string>();
|
|
|
|
|
- queue = new Invercargill.Fifo<string>();
|
|
|
|
|
|
|
+ processed_files = new HashSet<string>();
|
|
|
|
|
+ queue = new Fifo<string>();
|
|
|
|
|
|
|
|
// Start the watcher
|
|
// Start the watcher
|
|
|
new Thread<bool>("watcher", watch_directory);
|
|
new Thread<bool>("watcher", watch_directory);
|
|
@@ -79,9 +82,9 @@ namespace Webmify {
|
|
|
private static bool watch_directory() {
|
|
private static bool watch_directory() {
|
|
|
|
|
|
|
|
while(true) {
|
|
while(true) {
|
|
|
- var files = Invercargill.directory(watch_dir).to_set();
|
|
|
|
|
- files.remove_all(processed_files);
|
|
|
|
|
- processed_files.add_all(files);
|
|
|
|
|
|
|
+ var files = Iterate.directory(watch_dir).to_hash_set();
|
|
|
|
|
+ files.except_with(processed_files);
|
|
|
|
|
+ processed_files.union_with(files);
|
|
|
foreach (var file in files) {
|
|
foreach (var file in files) {
|
|
|
print(@"[Webmify] Adding file \"$file\" to queue.\n");
|
|
print(@"[Webmify] Adding file \"$file\" to queue.\n");
|
|
|
var path = Path.build_filename(watch_dir, file);
|
|
var path = Path.build_filename(watch_dir, file);
|