summaryrefslogtreecommitdiffstats
path: root/krebs/4lib
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2016-06-12 19:01:34 +0200
committermakefu <github@syntax-fehler.de>2016-06-12 19:01:34 +0200
commit2f940d77f1d5f3350adbbd946f0474260d36e0b4 (patch)
treea1b640d0b9641eb729bb04a73c748fda53523e72 /krebs/4lib
parented1d336fc85935b73d9f8a2486ea3e95503ab655 (diff)
parent29442eda7c864265ccf23df0b350572d5527dd86 (diff)
Merge remote-tracking branch 'cd/master'
Diffstat (limited to 'krebs/4lib')
-rw-r--r--krebs/4lib/types.nix6
1 files changed, 4 insertions, 2 deletions
diff --git a/krebs/4lib/types.nix b/krebs/4lib/types.nix
index 678ae7a60..4742877a7 100644
--- a/krebs/4lib/types.nix
+++ b/krebs/4lib/types.nix
@@ -334,7 +334,8 @@ types // rec {
# TODO two slashes
absolute-pathname = mkOptionType {
name = "POSIX absolute pathname";
- check = s: s == "/" || (pathname.check s && substring 0 1 s == "/");
+ check = x: let xs = splitString "/" x; xa = head xs; in
+ xa == "/" || (xa == "" && all filename.check (tail xs));
merge = mergeOneOption;
};
@@ -342,7 +343,8 @@ types // rec {
# TODO normalize slashes
pathname = mkOptionType {
name = "POSIX pathname";
- check = s: isString s && all filename.check (splitString "/" s);
+ check = x: let xs = splitString "/" x; in
+ all filename.check (if head xs == "" then tail xs else xs);
merge = mergeOneOption;
};