[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] [PATCH] Make chicken-install create the destinatio
From: |
Mario Domenech Goulart |
Subject: |
Re: [Chicken-hackers] [PATCH] Make chicken-install create the destination folder |
Date: |
Mon, 25 Apr 2016 22:54:51 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
On Mon, 25 Apr 2016 22:30:08 +0200 lemonboy <address@hidden> wrote:
> I was wondering why my fresh chicken5 install was acting up only to
> discover that when initializing the eggs repository using
> chicken-install's -i switch I had supplied a non-existing folder; the
> tool then ends up copying all the files, one over another, in the path
> specified by the user.
> Attached is a patch against the chicken-5 branch that fixes the problem.
>
> From b3b7cec9a18360bf6c1aa9904076f4c62701613b Mon Sep 17 00:00:00 2001
> From: LemonBoy <address@hidden>
> Date: Mon, 25 Apr 2016 22:23:41 +0200
> Subject: [PATCH] Create the destination folder for the -i command
> To: address@hidden
>
> ---
> chicken-install.scm | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/chicken-install.scm b/chicken-install.scm
> index a9e25ba..9d9fcd9 100644
> --- a/chicken-install.scm
> +++ b/chicken-install.scm
> @@ -230,6 +230,8 @@
> (copy (if *windows-shell*
> "copy"
> "cp -r")))
> + (unless (directory-exists? dir)
> + (create-directory dir))
> (print "copying required files to " dir " ...")
> (for-each
> (lambda (f)
Nice catch. However, I think it'd be better to just call
(create-directory dir #t). It's shorter and handles nested non-existing
directories.
On the other hand, `create-directory' is a bit broken, in my opinion
(but that's another issue -- maybe for CHICKEN 5). It's subject to race
conditions and will happily succeed if you give it an argument which is
any filesystem object to which file-exits? return a string (e.g., a
regular file). In its defense, this behavior is documented.
All the best.
Mario
--
http://parenteses.org/mario