[cig-commits] r15825 - doc/geodynamics.org/benchmarks/trunk
luis at geodynamics.org
luis at geodynamics.org
Sun Oct 18 00:18:12 PDT 2009
Author: luis
Date: 2009-10-18 00:18:11 -0700 (Sun, 18 Oct 2009)
New Revision: 15825
Modified:
doc/geodynamics.org/benchmarks/trunk/reload-firefox.scpt
doc/geodynamics.org/benchmarks/trunk/reload-firefox.sh
doc/geodynamics.org/benchmarks/trunk/watcher.c
Log:
Implemented smarter reloading
Modified: doc/geodynamics.org/benchmarks/trunk/reload-firefox.scpt
===================================================================
--- doc/geodynamics.org/benchmarks/trunk/reload-firefox.scpt 2009-10-18 07:18:03 UTC (rev 15824)
+++ doc/geodynamics.org/benchmarks/trunk/reload-firefox.scpt 2009-10-18 07:18:11 UTC (rev 15825)
@@ -14,5 +14,9 @@
tell application "Firefox" to activate
do shell script "open -a Firefox " & theUrl
end if
+ delay 1
+ -- tell application "MacVim" to activate
+ -- tell application "Emacs" to activate
+ tell application "System Events" to keystroke tab using {command down}
end run
Modified: doc/geodynamics.org/benchmarks/trunk/reload-firefox.sh
===================================================================
--- doc/geodynamics.org/benchmarks/trunk/reload-firefox.sh 2009-10-18 07:18:03 UTC (rev 15824)
+++ doc/geodynamics.org/benchmarks/trunk/reload-firefox.sh 2009-10-18 07:18:11 UTC (rev 15825)
@@ -1,2 +1,2 @@
#!/bin/bash
-osascript ./reload-firefox.scpt 2>/dev/null
+osascript ./reload-firefox.scpt $* 2>/dev/null
Modified: doc/geodynamics.org/benchmarks/trunk/watcher.c
===================================================================
--- doc/geodynamics.org/benchmarks/trunk/watcher.c 2009-10-18 07:18:03 UTC (rev 15824)
+++ doc/geodynamics.org/benchmarks/trunk/watcher.c 2009-10-18 07:18:11 UTC (rev 15825)
@@ -288,6 +288,8 @@
/* whether to reload browser when an event happens */
int reloading = 1;
+ char loaded[1024];
+ loaded[0] = '\0';
/* get list of files to monitor */
f = readfiles();
@@ -394,9 +396,26 @@
if (reloading)
{
- char cmd[1024];
- snprintf(cmd, 1024, "./reload-firefox.sh %s", n->path);
- system(cmd);
+ char html[1000];
+ int len = strlen(n->path);
+ strncpy(html, n->path, sizeof(html));
+ html[len+1] = '\0';
+ html[len] = 'l';
+ html[len-1] = 'm';
+ html[len-2] = 't';
+ html[len-3] = 'h';
+
+ if (strncmp(loaded, html, sizeof(html)) == 0)
+ {
+ system("./reload-firefox.sh");
+ }
+ else
+ {
+ char cmd[1024];
+ strncpy(loaded, html, sizeof(html));
+ snprintf(cmd, sizeof(cmd), "./reload-firefox.sh %s", html);
+ system(cmd);
+ }
}
}
}
More information about the CIG-COMMITS
mailing list