1 ! Copyright (C) 2018 Doug Coleman.
2 ! See https://factorcode.org/license.txt for BSD license.
3 USING: base91 combinators command-line fry io.directories
4 io.encodings.binary io.encodings.utf8 io.files io.pathnames
5 kernel modern modern.out namespaces sequences splitting strings ;
6 IN: tools.file-to-directory
8 ERROR: expected-one-path got ;
9 ERROR: expected-modern-path got ;
11 : write-directory-files ( path -- )
12 [ ".modern" ?tail drop dup make-directories ]
16 dup first "DIRECTORY:" head?
17 [ second first second >string make-directories ]
21 first3 nip swap "base91" head? [
27 [ dup parent-directory make-directories ] dip set-file-contents
32 : get-file-to-directory-path ( array -- path )
33 dup length 1 = [ expected-one-path ] unless
34 first dup ".modern" tail? [ expected-modern-path ] unless ;
36 : file-to-directory ( -- )
37 command-line get get-file-to-directory-path write-directory-files ;
39 MAIN: file-to-directory