diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/specification/lux/world/file.lux | 44 |
1 files changed, 13 insertions, 31 deletions
diff --git a/stdlib/source/specification/lux/world/file.lux b/stdlib/source/specification/lux/world/file.lux index 79eb871fe..147593f14 100644 --- a/stdlib/source/specification/lux/world/file.lux +++ b/stdlib/source/specification/lux/world/file.lux @@ -41,35 +41,17 @@ (do async.monad [fs (async.future fs)] ($_ _.and' - (_.cover' [/.un_nest] - (and (|> (/.un_nest fs parent) - (case> (#.Some _) - false - - #.None - true)) - (|> (/.un_nest fs child) - (case> (#.Some _) - false - - #.None - true)))) - (_.cover' [/.nest] - (|> (/.nest fs parent child) - (/.un_nest fs) - (case> (#.Some [parent' child']) - (and (text\= parent parent') - (text\= child child')) - - #.None - false))) + (_.cover' [/.rooted] + (let [path (/.rooted fs parent child)] + (and (text.starts_with? parent path) + (text.ends_with? child path)))) (_.cover' [/.parent] - (|> (/.nest fs parent child) + (|> (/.rooted fs parent child) (/.parent fs) (maybe\map (text\= parent)) (maybe.else false))) (_.cover' [/.name] - (|> (/.nest fs parent child) + (|> (/.rooted fs parent child) (/.name fs) (text\= child))) )))) @@ -138,8 +120,8 @@ (def: (directory_files&sub_directories fs parent sub_dir child) (-> (/.System Async) /.Path /.Path /.Path (Async Bit)) - (let [sub_dir (/.nest fs parent sub_dir) - child (/.nest fs parent child)] + (let [sub_dir (/.rooted fs parent sub_dir) + child (/.rooted fs parent child)] (do async.monad [made_sub? (\ fs make_directory sub_dir) directory_files (\ fs directory_files parent) @@ -157,8 +139,8 @@ (def: (move&delete fs parent child alternate_child) (-> (/.System Async) /.Path Text Text (Async Bit)) - (let [origin (/.nest fs parent child) - destination (/.nest fs parent alternate_child)] + (let [origin (/.rooted fs parent child) + destination (/.rooted fs parent alternate_child)] (do {! async.monad} [moved? (\ fs move destination origin) lost? (|> origin @@ -191,7 +173,7 @@ in (do {! async.monad} [fs (async.future fs) - #let [path (/.nest fs parent child)] + #let [path (/.rooted fs parent child)] directory?&make_directory (..directory?&make_directory fs parent) @@ -233,8 +215,8 @@ in (do {! async.monad} [fs (async.future fs) - #let [dir/1 (/.nest fs dir/0 dir/1) - dir/2 (/.nest fs dir/1 dir/2)] + #let [dir/1 (/.rooted fs dir/0 dir/1) + dir/2 (/.rooted fs dir/1 dir/2)] pre_dir/0 (\ fs directory? dir/0) pre_dir/1 (\ fs directory? dir/1) pre_dir/2 (\ fs directory? dir/2) |