Subject: Re: [bug#60521] [PATCH] home: Add home-stow-migration-service.

From: Ludovic Courtès <[email-masked]>
Date: Mon, 29 Jan 2024 14:20:10 +0100

Sergey Trofimov <[email-masked]> skribis:

> (define* (as-local-files dir #:optional (trim-prefix dir))
>   (let ((absolute-dir (string-append (getcwd) "/" dir))
>         (to-trim (string-append (getcwd) "/" trim-prefix "/")))
>     (map (lambda (fn)
>            (list
>             (del-prefix to-trim fn)
>             (local-file (canonicalize-path fn) (del-prefix "." 
>             (basename fn)) #:recursive? #t)))
>          (find-files absolute-dir))))

As you saw, I proposed a different solution: capturing
(current-source-directory) in ‘home-dotfiles-configuration’ and using
that to compute absolute file names (without ever calling
‘canonicalize-path’).

Using ‘getcwd’ would be incorrect or at least surprising: it would
resolve file names relative to the current directory instead of relative
to the directory that contains the source file.

Ludo’.