What platform is Arc being developed on? I checked the man page for mkdir on Ubuntu and Mac OS X and I don't see a -f flag which is being used in ensure-dir.
Is it possible to fix the next release of Arc to work on Linux? I don't think this particular patch (see my comment below) is the best approach because of the overhead of (uname), but if Arc can detect the platform it's running on in a more efficient manner, then some conditional code could be put in place. Alternatively, I suppose uname could be memoized.
--- arc1/arc.arc 2008年02月13日 11:27:37.000000000 -0500
+++ ../arc1/arc.arc 2008年02月23日 21:14:50.000000000 -0500
@@ -1195,11 +1195,24 @@
(def ensure-dir (path)
(unless (dir-exists path)
- (system (string "mkdir -f " path))))
+ (system (string "mkdir -p " path))))
+
+(def uname nil
+ (let val (tostring (system "uname"))
+ (cut val 0 (- (len val) 1))))
(def date ((o time (seconds)))
- (let val (tostring (system (string "date -u -r " time " \"+%Y-%m-%d\"")))
- (cut val 0 (- (len val) 1))))
+ (let val (tostring (system
+ (string
+ "date -u "
+ (if
+ (is (uname) "Linux")
+ ;; Linux wants -d and an interval
+ (string "-d \"" (- 1 (since time)) " seconds\"")
+ ;; BSD wants -r and epoch seconds
+ (string "-r " time))
+ " \"+%Y-%m-%d\"")))
+ (cut val 0 (- (len val) 1))))
(def count (test x)
(with (n 0 testf (testify test))-----
As an aside, I notice that both the OpenID and "Arc at work" use system to do the heavy lifting. I propose a law that any sufficiently complicated Arc application requires use of "system" to get things done.
-----