]> gitweb.factorcode.org Git - factor.git/commitdiff
io.files.info: use directory?, symbolic-link?, and regular-file?.
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 6 Aug 2015 01:33:35 +0000 (18:33 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 6 Aug 2015 01:33:35 +0000 (18:33 -0700)
basis/ftp/server/server.factor
basis/io/directories/hierarchy/hierarchy.factor
basis/io/files/links/links.factor
basis/tools/completion/completion.factor
basis/vocabs/hierarchy/hierarchy.factor
extra/codebook/codebook.factor
extra/io/files/trash/unix/unix.factor
extra/tools/tree/tree.factor

index 6e9dc01f1caf8411e32b608ebb7dce472d02de99..6dacaf72cc3ce2af7c7b835014d53fd456f07cf2 100644 (file)
@@ -72,7 +72,7 @@ C: <ftp-disconnect> ftp-disconnect
 : can-serve-file? ( path -- ? )
     {
         [ exists? ]
-        [ file-info type>> +regular-file+ = ]
+        [ file-info regular-file? ]
         [ serving? ]
     } 1&& ;
 
index b39587af2ed7c000df2a773dfa9a97c33b6a0595..663e2c87128bf7ed21113cff0e28212ae14ed9f2 100644 (file)
@@ -10,7 +10,7 @@ IN: io.directories.hierarchy
 : directory-tree-files% ( path prefix -- )
     [ dup directory-entries ] dip '[
         [ name>> [ append-path ] [ _ prepend-path ] bi ]
-        [ type>> +directory+ = ] bi over ,
+        [ directory? ] bi over ,
         [ directory-tree-files% ] [ 2drop ] if
     ] with each ;
 
index 8526321a854684b35c68cd67458f54ac268c4d75..42a5535cca988bb1839f4062e699b56d56baa57d 100644 (file)
@@ -27,7 +27,7 @@ ERROR: too-many-symlinks path n ;
 
 : (follow-links) ( n path -- path' )
     over 0 = [ symlink-depth get too-many-symlinks ] when
-    dup link-info type>> +symbolic-link+ =
+    dup link-info symbolic-link?
     [ [ 1 - ] [ follow-link ] bi* (follow-links) ]
     [ nip ] if ; inline recursive
 
index b3632c9f29fded28f3fdc74014f2d7c3c4a0c502..58bf1d415688d2586a74990928dfdd061cfebaef 100644 (file)
@@ -2,11 +2,10 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs colors.constants combinators
 combinators.short-circuit fry io.directories io.files
-io.files.info io.pathnames kernel locals make math math.order
-sequences sequences.private sorting splitting typed
+io.files.info io.files.types io.pathnames kernel locals make
+math math.order sequences sequences.private sorting splitting
 unicode.categories unicode.data vectors vocabs vocabs.hierarchy
 ;
-
 IN: tools.completion
 
 <PRIVATE
@@ -115,11 +114,11 @@ PRIVATE>
 : directory-paths ( directory -- alist )
     dup '[
         [
-            [ dup _ prepend-path ]
-            [ file-info directory? [ path-separator append ] when ]
+            [ name>> dup _ prepend-path ]
+            [ directory? [ path-separator append ] when ]
             bi swap
         ] { } map>assoc
-    ] with-directory-files ;
+    ] with-directory-entries ;
 
 PRIVATE>
 
index b80d760b44e641419ceba6c5c13561585a96bf01..96b8723e684d46a9a2c45da61da97a9124183fde 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2007, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs combinators.short-circuit fry
-io.directories io.files io.files.types io.pathnames kernel make
+io.directories io.files io.files.info io.pathnames kernel make
 memoize namespaces sequences sets sorting splitting vocabs
 vocabs.loader vocabs.metadata ;
 IN: vocabs.hierarchy
@@ -17,7 +17,7 @@ M: vocab-prefix vocab-name name>> ;
 : visible-dirs ( seq -- seq' )
     [
         {
-            [ type>> +directory+ = ]
+            [ directory? ]
             [ name>> "." head? not ]
         } 1&&
     ] filter ;
index af05ff28948c125b28969b1982abc4465cb49fdf..0fd960e7f61154a536a5ae2f2609c6e5609d5a16 100644 (file)
@@ -45,7 +45,7 @@ TUPLE: code-file
 : include-file-name? ( name -- ? )
     {
         [ path-components [ "." head? ] any? not ]
-        [ link-info type>> +regular-file+ = ]
+        [ link-info regular-file? ]
     } 1&& ;
 
 : code-files ( dir -- files )
index 56b474efe88fda7b5be5ef7b8f8b0b82a369089d..99d82078a7443892d0ab9b8bf39de5d8447cd9f4 100644 (file)
@@ -27,7 +27,7 @@ IN: io.files.trash.unix
     {
         [ file-info directory? ]
         [ sticky? ]
-        [ link-info type>> +symbolic-link+ = not ]
+        [ link-info symbolic-link? not ]
     } 1&& [ "invalid trash path" throw ] unless ;
 
 : trash-home ( -- path )
index ad0c2e84fc8deccf2df3725fbcff4cb5dc15eb96..cf2ab92a5ab3aee2e075a34bbd8907c879a65e96 100644 (file)
@@ -30,8 +30,7 @@ DEFER: write-tree
     ] 2bi #directories [ 1 + ] change-global ;
 
 : write-entry ( entry indents -- )
-    nl over type>> +directory+ =
-    [ write-dir ] [ write-file ] if ;
+    nl over directory? [ write-dir ] [ write-file ] if ;
 
 :: write-tree ( path indents -- )
     path [