[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Getting the name of file-like objects
From: |
Maxime Devos |
Subject: |
Re: Getting the name of file-like objects |
Date: |
Sat, 02 Apr 2022 10:32:20 +0200 |
User-agent: |
Evolution 3.38.3-1 |
Justin Veilleux schreef op vr 01-04-2022 om 16:29 [-0400]:
> (define (unzip f)
> (computed-file (string-append (name f) "-unzipped")
> #~(begin
> (system* (string-append #$unzip "/bin/unzip")
(unrelated) you can do #+(file-append unzip "/bin/unzip") here. The
'file-append' is not very important here, but the #+ is. The
difference between #+ (cf. 'native-inputs) and #$ (cf. 'inputs') is
important when cross-compiling.
Also, I would use 'invoke' instead of 'system*' here -- 'invoke' throws
an exception if it fails (making the derivation fail to build), whereas
'system*' silently returns an integer.
> "-d" #$output
> #$file))
> #$out))
> ```
>
> Is there someting which ressembles the imaginary `name` function
> I used above?
computed-file-name, local-file-name, package-name ... I don't think
there's some generic procedure for this.
Greetings,
Maxime.
signature.asc
Description: This is a digitally signed message part