trivial-builders: support '/' in writeTextDir
Before one would get the following error nix-repl> pkgs.writeTextDir "share/my-file" "foo" error: invalid character '/' in name 'share/my-file' Fixes #50347
This commit is contained in:
parent
1aaa9ba3d8
commit
6900a327ad
1 changed files with 7 additions and 3 deletions
|
@ -94,17 +94,21 @@ rec {
|
|||
|
||||
/*
|
||||
* Writes a text file to nix store in a specific directory with no
|
||||
* optional parameters available. Name passed is the destination.
|
||||
* optional parameters available.
|
||||
*
|
||||
* Example:
|
||||
* # Writes contents of file to /nix/store/<store path>/<name>
|
||||
* # Writes contents of file to /nix/store/<store path>/share/my-file
|
||||
* writeTextDir "share/my-file"
|
||||
* ''
|
||||
* Contents of File
|
||||
* '';
|
||||
*
|
||||
*/
|
||||
writeTextDir = name: text: writeTextFile {inherit name text; destination = "/${name}";};
|
||||
writeTextDir = path: text: writeTextFile {
|
||||
inherit text;
|
||||
name = builtins.baseNameOf path;
|
||||
destination = "/${path}";
|
||||
};
|
||||
|
||||
/*
|
||||
* Writes a text file to /nix/store/<store path> and marks the file as
|
||||
|
|
Loading…
Reference in a new issue