Index: common.scm ================================================================== --- common.scm +++ common.scm @@ -1062,33 +1062,10 @@ (pathname-directory (pathname-directory (pathname-directory exe-path)))) #f))) -;; return first path that can be created or already exists and is writable -;; -(define (common:get-create-writeable-dir dirs) - (if (null? dirs) - #f - (let loop ((hed (car dirs)) - (tal (cdr dirs))) - (let ((res (or (and (directory? hed) - (file-write-access? hed) - hed) - (handle-exceptions - exn - (begin - (debug:print-info 0 *default-log-port* "could not create " hed ", this might cause problems down the road.") - #f) - (create-directory hed #t))))) - (if (and (string? res) - (directory? res)) - res - (if (null? tal) - #f - (loop (car tal)(cdr tal)))))))) - ;; return the youngest timestamp . filename ;; (define (common:get-youngest glob-list) (let ((all-files (apply append (map (lambda (patt) Index: commonmod.scm ================================================================== --- commonmod.scm +++ commonmod.scm @@ -40,22 +40,47 @@ (configf:lookup configdat "setup" "testsuite" ) (get-environment-variable "MT_TESTSUITE_NAME") (if (string? areapath ) (pathname-file areapath) #f)))) ;; (pathname-file (current-directory))))) + +;; return first path that can be created or already exists and is writable +;; +(define (common:get-create-writeable-dir dirs) + (if (null? dirs) + #f + (let loop ((hed (car dirs)) + (tal (cdr dirs))) + (let ((res (or (and (directory? hed) + (file-write-access? hed) + hed) + (handle-exceptions + exn + (begin + ;; TODO add print of exception here + ;; (debug:print-info 0 *default-log-port* "could not create " hed ", this might cause problems down the road.") + #f) + (create-directory hed #t))))) + (if (and (string? res) + (directory? res)) + res + (if (null? tal) + #f + (loop (car tal)(cdr tal)))))))) ;; (define common:get-area-name common:get-area-name) (define (common:get-db-tmp-area alldat) - (let* ((dbdir #f)) + (let* ((dbdir #f) + (log-port (alldat-log-port alldat))) (if (alldat-tmppath alldat) (alldat-tmppath alldat) (if (alldat-areapath alldat) ;; common:get-create-writeable-dir (handle-exceptions exn (begin - (debug:print-error 0 *default-log-port* "Couldn't create path to " dbdir) + (debug:print-error 0 log-port "Couldn't create path to " dbdir) (exit 1)) (let ((dbpath (common:get-create-writeable-dir (list (conc "/tmp/" (current-user-name) "/megatest_localdb/" (common:get-area-name alldat) "/"