Mathieu Lirzin <m...@gnu.org> writes: > * modules/shepherd/support.scm (user-dmddir): Rename to ... > (%user-shepherd-dir): ... this. Honor XDG variables and use > '~/.config/shepherd' as default value. All consumers changed. > (mkdir-p): New procedure. Export it. > (default-config-file): Use it. > (verify-dir): Likewise. > --- > modules/shepherd/support.scm | 45 > ++++++++++++++++++++++++++++++++++++-------- > 1 file changed, 37 insertions(+), 8 deletions(-) [...] > +(define* (mkdir-p dir #:optional (mode (umask))) ;copied from Guix ^^^ not in Guix yet. > + "Create directory DIR and all its ancestors." > + (define absolute? > + (string-prefix? "/" dir)) > + > + (define not-slash > + (char-set-complement (char-set #\/))) > + > + (let loop ((components (string-tokenize dir not-slash)) > + (root (if absolute? > + "" > + "."))) > + (match components > + ((head tail ...) > + (let ((path (string-append root "/" head))) > + (catch 'system-error > + (lambda () > + (mkdir path mode) > + (loop tail path)) > + (lambda args > + (if (= EEXIST (system-error-errno args)) > + (loop tail path) > + (apply throw args)))))) > + (() #t))))
I have tried to apply this change (add an optional parameter) on top of Guix, but it produces a ton of failures for ‘make check’ :). So my conclusion is that it is not possible to set a default value. So I think it required to do something like: (define* (mkdir-p dir #:optional mode) ... (if mode (mkdir path mode) (mkdir path)) ...) Am I correct? -- Mathieu Lirzin