lib/file-type: partially apply hasPrefix and removePrefix
This commit is contained in:
committed by
Robert Helgesson
parent
7834e3fb36
commit
411408f523
@@ -15,6 +15,8 @@ let
|
|||||||
removePrefix
|
removePrefix
|
||||||
types
|
types
|
||||||
;
|
;
|
||||||
|
isAbsolutePath = hasPrefix "/";
|
||||||
|
removeHomePrefix = removePrefix (homeDirectory + "/");
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# Constructs a type suitable for a `home.file` like option. The
|
# Constructs a type suitable for a `home.file` like option. The
|
||||||
@@ -46,9 +48,9 @@ in
|
|||||||
apply =
|
apply =
|
||||||
p:
|
p:
|
||||||
let
|
let
|
||||||
absPath = if hasPrefix "/" p then p else "${basePath}/${p}";
|
absPath = if isAbsolutePath p then p else "${basePath}/${p}";
|
||||||
in
|
in
|
||||||
removePrefix (homeDirectory + "/") absPath;
|
removeHomePrefix absPath;
|
||||||
defaultText = literalExpression "name";
|
defaultText = literalExpression "name";
|
||||||
description = ''
|
description = ''
|
||||||
Path to target file relative to ${basePathDesc}.
|
Path to target file relative to ${basePathDesc}.
|
||||||
|
|||||||
Reference in New Issue
Block a user