18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
;; data-structures posix
srfi-1
;; srfi-13
srfi-69
;; ports
extras
regex
)
(define (mutils:hierhash-ref hh . keys)
(if (null? keys)
#f
(let loop ((ht hh)
(key (car keys))
|
>
|
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
;; data-structures posix
srfi-1
;; srfi-13
srfi-69
;; ports
extras
regex
posix
)
(define (mutils:hierhash-ref hh . keys)
(if (null? keys)
#f
(let loop ((ht hh)
(key (car keys))
|
179
180
181
182
183
184
185
186
|
(define (mutils:keys @hierlist . @path)
(map (lambda (@l)
(if (and (list? @l)(not (null? @l)))
(car @l)))
(if (null? @path) @hierlist
(apply mutils:hier-list-get @hierlist @path))))
)
|
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
|
(define (mutils:keys @hierlist . @path)
(map (lambda (@l)
(if (and (list? @l)(not (null? @l)))
(car @l)))
(if (null? @path) @hierlist
(apply mutils:hier-list-get @hierlist @path))))
;;======================================================================
;; Other utils
;;======================================================================
#;(define (check-write-create fpath)
(and (file-write-access? fpath)
(let ((fname (conc fpath "/junk ". (current-seconds) "-" (random 10000))))
(print "trying to create/remove " fname)
(handle-exceptions
exn
#f
(begin
(with-output-to-file fname
(lambda ()
(print "You can delete this file")))
(delete-file fname)
#t)))))
;; do some sanity checks on the system
;;
(define (mutils:syscheck)
;; current dir writeable and do megatest.config, runconfigs.config files exist/readable
(print "Current directory " (current-directory) " writeable: "
(if #;(check-file-create ".")
(file-write-access? ".")"yes" "no"))
;; home dir writeable
;; /tmp writeable
;; load configs
;; each run disk read/write
;; link tree writeable
)
)
|