aboutsummaryrefslogtreecommitdiff
path: root/module/vcomponent/util/parse-cal-path.scm
diff options
context:
space:
mode:
Diffstat (limited to 'module/vcomponent/util/parse-cal-path.scm')
-rw-r--r--module/vcomponent/util/parse-cal-path.scm25
1 files changed, 12 insertions, 13 deletions
diff --git a/module/vcomponent/util/parse-cal-path.scm b/module/vcomponent/util/parse-cal-path.scm
index 24eee04e..33dbd0cc 100644
--- a/module/vcomponent/util/parse-cal-path.scm
+++ b/module/vcomponent/util/parse-cal-path.scm
@@ -1,3 +1,5 @@
+;;; TODO remove this module, it should be part of the vdir interface
+
(define-module (vcomponent util parse-cal-path)
:use-module (hnh util)
:use-module ((calp util time) :select (report-time!))
@@ -17,24 +19,21 @@
(define cal
(case (stat:type st)
[(regular)
- (let ((comp (call-with-input-file path parse-calendar)))
- (set! (prop comp '-X-HNH-SOURCETYPE) 'file)
- comp) ]
+ (prop (call-with-input-file path parse-calendar)
+ '-X-HNH-SOURCETYPE 'file)]
[(directory)
(report-time! (G_ "Parsing ~a") path)
- (let ((comp (parse-vdir path)))
- (set! (prop comp '-X-HNH-SOURCETYPE) 'vdir
- (prop comp '-X-HNH-DIRECTORY) path)
- comp)]
+ (set-properties (parse-vdir path)
+ (cons '-X-HNH-SOURCETYPE 'vdir)
+ (cons '-X-HNH-DIRECTORY path))]
[(block-special char-special fifo socket unknown symlink)
=> (lambda (t) (scm-error 'misc-error "parse-cal-path"
(G_ "Can't parse file of type ~s")
(list t)
#f))]))
- (unless (prop cal "NAME")
- (set! (prop cal "NAME")
- (or (prop cal "X-WR-CALNAME")
- (string-append "[" (basename path) "]"))))
-
- cal)
+ (if (prop cal 'NAME)
+ cal
+ (prop cal 'NAME
+ (or (prop cal 'X-WR-CALNAME)
+ (string-append "[" (basename path) "]")))))