From 0444af4a69629b68792a9a82db4587a49a4fad40 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 20 Dec 2021 15:06:16 -0600 Subject: [PATCH] io.files: exists? -> file-exists? and rename primitive. Fixes #2507 --- .../libraries/finder/macosx/macosx.factor | 2 +- .../libraries/finder/windows/windows.factor | 2 +- basis/bootstrap/image/download/download.factor | 2 +- .../image/primitives/primitives.factor | 2 +- basis/command-line/command-line.factor | 2 +- .../visual-studio-code.factor | 2 +- basis/ftp/server/server.factor | 4 ++-- basis/globs/globs.factor | 2 +- .../gobject-introspection.factor | 4 ++-- basis/help/html/html.factor | 2 +- basis/http/client/client.factor | 2 +- basis/http/server/static/static.factor | 4 ++-- basis/io/directories/directories-tests.factor | 18 +++++++++--------- basis/io/directories/directories.factor | 2 +- basis/io/directories/unix/unix.factor | 2 +- basis/io/files/info/info-docs.factor | 2 +- basis/io/files/info/info.factor | 4 ++-- basis/io/files/links/unix/unix.factor | 2 +- basis/io/files/temp/macosx/macosx.factor | 2 +- basis/io/files/unique/unique-tests.factor | 2 +- basis/io/files/windows/windows-tests.factor | 2 +- basis/io/launcher/unix/unix-tests.factor | 2 +- basis/io/monitors/monitors-tests.factor | 6 +++--- .../monitors/recursive/recursive-tests.factor | 2 +- basis/io/sockets/secure/openssl/openssl.factor | 2 +- basis/io/standard-paths/unix/unix.factor | 4 ++-- basis/io/standard-paths/windows/windows.factor | 2 +- basis/logging/parser/parser.factor | 2 +- basis/logging/server/server.factor | 2 +- basis/tools/completion/completion.factor | 2 +- basis/tools/deploy/backend/backend.factor | 4 ++-- basis/tools/deploy/macosx/macosx.factor | 4 ++-- basis/tools/deploy/windows/windows.factor | 2 +- basis/tools/scaffold/scaffold.factor | 4 ++-- basis/tools/which/which.factor | 2 +- basis/ui/backend/gtk/gtk.factor | 2 +- basis/vocabs/files/files.factor | 4 ++-- basis/vocabs/hierarchy/hierarchy.factor | 4 ++-- basis/vocabs/metadata/metadata.factor | 16 ++++++++-------- basis/vocabs/refresh/monitor/monitor.factor | 2 +- basis/vocabs/refresh/refresh.factor | 4 ++-- core/bootstrap/stage1.factor | 2 +- core/io/files/files-docs.factor | 2 +- core/io/files/files-tests.factor | 2 +- core/io/files/files.factor | 8 +++++--- core/parser/parser.factor | 2 +- core/source-files/source-files.factor | 2 +- core/vocabs/loader/loader.factor | 2 +- extra/c/preprocessor/preprocessor.factor | 4 ++-- extra/combinators/extras/extras-tests.factor | 6 +++--- extra/cpu/8080/emulator/emulator.factor | 2 +- extra/fastcgi/fastcgi.factor | 2 +- extra/gdbm/gdbm-docs.factor | 4 ++-- extra/gdbm/gdbm-tests.factor | 4 ++-- extra/gdbm/gdbm.factor | 2 +- extra/gemini/cli/cli.factor | 4 ++-- extra/gemini/server/server.factor | 4 ++-- extra/geo-ip/geo-ip.factor | 2 +- extra/git/git.factor | 2 +- extra/gopher/server/server.factor | 4 ++-- extra/graphviz/graphviz-tests.factor | 2 +- extra/graphviz/render/render.factor | 2 +- extra/io/files/acls/macosx/macosx.factor | 2 +- extra/io/files/trash/unix/unix.factor | 4 ++-- .../data-sets/data-sets.factor | 4 ++-- extra/mason/cleanup/cleanup.factor | 2 +- extra/mason/git/git.factor | 2 +- extra/mason/release/tidy/tidy.factor | 2 +- extra/mason/report/report-tests.factor | 2 +- extra/modern/paths/paths.factor | 2 +- extra/project-euler/041/041.factor | 2 +- extra/protocols/tftp/tftp.factor | 2 +- .../max-licenses/max-licenses.factor | 2 +- extra/terminfo/terminfo.factor | 4 ++-- extra/tldr/tldr.factor | 2 +- extra/tools/cat/cat.factor | 2 +- extra/tools/copy/copy.factor | 2 +- .../graphviz/graphviz-tests.factor | 2 +- .../image-analyzer/image-analyzer-tests.factor | 2 +- extra/webapps/imagebin/imagebin.factor | 2 +- .../mason/docs-update/docs-update.factor | 6 +++--- misc/vim/syntax/factor/generated.vim | 2 +- 82 files changed, 127 insertions(+), 125 deletions(-) diff --git a/basis/alien/libraries/finder/macosx/macosx.factor b/basis/alien/libraries/finder/macosx/macosx.factor index 795539f455..0ff1c8457a 100644 --- a/basis/alien/libraries/finder/macosx/macosx.factor +++ b/basis/alien/libraries/finder/macosx/macosx.factor @@ -122,7 +122,7 @@ PRIVATE> : dyld-find ( name -- path/f ) dyld-search-paths [ { - { [ dup exists? ] [ file-info regular-file? ] } + { [ dup file-exists? ] [ file-info regular-file? ] } { [ use-dyld-shared-cache? ] [ _dyld_shared_cache_contains_path ] } [ drop f ] } cond diff --git a/basis/alien/libraries/finder/windows/windows.factor b/basis/alien/libraries/finder/windows/windows.factor index e9a5202ce2..4c6586f719 100644 --- a/basis/alien/libraries/finder/windows/windows.factor +++ b/basis/alien/libraries/finder/windows/windows.factor @@ -32,7 +32,7 @@ IN: alien.libraries.finder.windows : find-library-paths ( name -- path/f ) candidate-paths [ - { [ exists? ] [ file-info regular-file? ] } 1&& + { [ file-exists? ] [ file-info regular-file? ] } 1&& ] find nip ; : find-library-file ( name -- path/f ) diff --git a/basis/bootstrap/image/download/download.factor b/basis/bootstrap/image/download/download.factor index e554e2aade..ccef1a0c12 100644 --- a/basis/bootstrap/image/download/download.factor +++ b/basis/bootstrap/image/download/download.factor @@ -17,7 +17,7 @@ CONSTANT: url URL" http://downloads.factorcode.org/images/master/" download-checksums at ; : need-new-image? ( image -- ? ) - dup exists? + dup file-exists? [ [ file-checksum ] [ download-checksum ] bi = not ] [ drop t ] if ; diff --git a/basis/bootstrap/image/primitives/primitives.factor b/basis/bootstrap/image/primitives/primitives.factor index bdb0953758..f9c9bc7680 100644 --- a/basis/bootstrap/image/primitives/primitives.factor +++ b/basis/bootstrap/image/primitives/primitives.factor @@ -220,7 +220,7 @@ CONSTANT: all-primitives { { "io.files.private" { - { "(exists?)" ( path -- ? ) "existsp" { string } { object } f } + { "(file-exists?)" ( path -- ? ) "existsp" { string } { object } f } } } { diff --git a/basis/command-line/command-line.factor b/basis/command-line/command-line.factor index a90f7f5ad1..18ffec8925 100644 --- a/basis/command-line/command-line.factor +++ b/basis/command-line/command-line.factor @@ -41,7 +41,7 @@ SYMBOL: command-line : load-vocab-roots ( -- ) "user-init" get [ - "~/.factor-roots" dup exists? [ + "~/.factor-roots" dup file-exists? [ utf8 file-lines harvest [ add-vocab-root ] each ] [ drop ] if "roots" get [ diff --git a/basis/editors/visual-studio-code/visual-studio-code.factor b/basis/editors/visual-studio-code/visual-studio-code.factor index 45c819c2e8..ebf633559c 100644 --- a/basis/editors/visual-studio-code/visual-studio-code.factor +++ b/basis/editors/visual-studio-code/visual-studio-code.factor @@ -21,7 +21,7 @@ M: visual-studio-code find-visual-studio-code-path [ "Code" which ] [ home "VSCode-linux-x64/Code" append-path ] [ "/usr/share/code/code" ] - } [ dup exists? [ drop f ] unless ] map-compose 0|| ] } + } [ dup file-exists? [ drop f ] unless ] map-compose 0|| ] } { macosx [ "com.microsoft.VSCode" find-native-bundle [ "Contents/MacOS/Electron" append-path ] [ f ] if* ] } diff --git a/basis/ftp/server/server.factor b/basis/ftp/server/server.factor index 72f1ad5420..65ec841e9e 100644 --- a/basis/ftp/server/server.factor +++ b/basis/ftp/server/server.factor @@ -66,11 +66,11 @@ C: ftp-disconnect resolve-symlinks server get serving-directory>> head? ; : can-serve-directory? ( path -- ? ) - { [ exists? ] [ file-info directory? ] [ serving? ] } 1&& ; + { [ file-exists? ] [ file-info directory? ] [ serving? ] } 1&& ; : can-serve-file? ( path -- ? ) { - [ exists? ] + [ file-exists? ] [ file-info regular-file? ] [ serving? ] } 1&& ; diff --git a/basis/globs/globs.factor b/basis/globs/globs.factor index e2bbb99aee..21cc9eab75 100644 --- a/basis/globs/globs.factor +++ b/basis/globs/globs.factor @@ -123,7 +123,7 @@ DEFER: glob% :: glob-literal% ( root globs -- ) globs unclip :> ( remaining glob ) - root glob append-path dup exists? [ + root glob append-path dup file-exists? [ remaining over file-info ?glob% ] [ drop diff --git a/basis/gobject-introspection/gobject-introspection.factor b/basis/gobject-introspection/gobject-introspection.factor index 23fb5541c7..ae90e73e05 100644 --- a/basis/gobject-introspection/gobject-introspection.factor +++ b/basis/gobject-introspection/gobject-introspection.factor @@ -33,11 +33,11 @@ M: gir-not-found summary ] { } make ; :: resolve-gir-path ( path -- path ) - path exists? + path file-exists? [ path ] [ current-vocab-dirs custom-gir-dirs system-gir-dirs 3append sift :> paths - paths [ path append-path exists? ] find nip + paths [ path append-path file-exists? ] find nip [ path append-path ] [ path paths gir-not-found ] if* ] if ; diff --git a/basis/help/html/html.factor b/basis/help/html/html.factor index c18e91025a..c9e6981e06 100644 --- a/basis/help/html/html.factor +++ b/basis/help/html/html.factor @@ -145,7 +145,7 @@ M: pathname url-of "@2x" over subseq? [ "." split1-last "@2x." glue ] unless ; : ?copy-file ( from to -- ) - dup exists? [ 2drop ] [ copy-file ] if ; + dup file-exists? [ 2drop ] [ copy-file ] if ; : cache-images ( body -- body' ) dup [ diff --git a/basis/http/client/client.factor b/basis/http/client/client.factor index 3b8e30642a..14077dc623 100644 --- a/basis/http/client/client.factor +++ b/basis/http/client/client.factor @@ -283,7 +283,7 @@ PRIVATE> ] with-file-writer ; : ?download-to ( url file -- ) - dup exists? [ 2drop ] [ download-to ] if ; + dup file-exists? [ 2drop ] [ download-to ] if ; : download ( url -- ) dup download-name download-to ; diff --git a/basis/http/server/static/static.factor b/basis/http/server/static/static.factor index c05c6f1d5d..d594bfd35e 100644 --- a/basis/http/server/static/static.factor +++ b/basis/http/server/static/static.factor @@ -160,7 +160,7 @@ TUPLE: file-responder root hook special index-names allow-listings ; : find-index ( filename -- path ) file-responder get index-names>> - [ append-path dup exists? [ drop f ] unless ] with map-find + [ append-path dup file-exists? [ drop f ] unless ] with map-find drop ; : serve-directory ( filename -- response ) @@ -173,7 +173,7 @@ TUPLE: file-responder root hook special index-names allow-listings ; ] if ; : serve-object ( filename -- response ) - serving-path dup exists? + serving-path dup file-exists? [ dup file-info directory? [ serve-directory ] [ serve-file ] if ] [ drop <404> ] if ; diff --git a/basis/io/directories/directories-tests.factor b/basis/io/directories/directories-tests.factor index 8b8d038569..2f2d95ff13 100644 --- a/basis/io/directories/directories-tests.factor +++ b/basis/io/directories/directories-tests.factor @@ -25,10 +25,10 @@ tools.test ; [ { t t f } [ "blahblah" make-directory - "blahblah" exists? + "blahblah" file-exists? "blahblah" file-info directory? "blahblah" delete-directory - "blahblah" exists? + "blahblah" file-exists? ] unit-test { "file1 contents" } [ @@ -84,8 +84,8 @@ tools.test ; { } [ "test-foo.txt" delete-file ] unit-test { } [ "test-bar.txt" delete-file ] unit-test - { f } [ "test-foo.txt" exists? ] unit-test - { f } [ "test-bar.txt" exists? ] unit-test + { f } [ "test-foo.txt" file-exists? ] unit-test + { f } [ "test-bar.txt" file-exists? ] unit-test { } [ "test-blah" make-directory ] unit-test @@ -94,13 +94,13 @@ tools.test ; ] unit-test { t } [ - "test-blah/fooz" exists? + "test-blah/fooz" file-exists? ] unit-test { } [ "test-blah/fooz" delete-file ] unit-test { } [ "test-blah" delete-directory ] unit-test - { f } [ "test-blah" exists? ] unit-test + { f } [ "test-blah" file-exists? ] unit-test { } [ "delete-tree-test/a/b/c" make-directories ] unit-test @@ -164,14 +164,14 @@ tools.test ; { f t } [ "foo" [ make-directories ] keep [ - "bar" exists? + "bar" file-exists? vm-path "-e=USE: io.directories \"bar\" touch-file" 2array try-output-process - "bar" exists? + "bar" file-exists? ] with-directory ] unit-test { t } [ - "one/two/three" make-parent-directories parent-directory exists? + "one/two/three" make-parent-directories parent-directory file-exists? ] unit-test ] with-test-directory diff --git a/basis/io/directories/directories.factor b/basis/io/directories/directories.factor index ce07a215b4..11c000b229 100644 --- a/basis/io/directories/directories.factor +++ b/basis/io/directories/directories.factor @@ -27,7 +27,7 @@ DEFER: make-parent-directories [ "." = ] [ root-directory? ] [ empty? ] - [ exists? ] + [ file-exists? ] } 1|| [ make-parent-directories dup make-directory diff --git a/basis/io/directories/unix/unix.factor b/basis/io/directories/unix/unix.factor index 65c1eea8ee..798f64d619 100644 --- a/basis/io/directories/unix/unix.factor +++ b/basis/io/directories/unix/unix.factor @@ -13,7 +13,7 @@ CONSTANT: mkdir-mode flags{ USER-ALL GROUP-ALL OTHER-ALL } ! 0o777 M: unix touch-file normalize-path - dup exists? [ touch ] [ + dup file-exists? [ touch ] [ touch-mode file-mode open-file close-file ] if ; diff --git a/basis/io/files/info/info-docs.factor b/basis/io/files/info/info-docs.factor index e40681f174..c405cce1f5 100644 --- a/basis/io/files/info/info-docs.factor +++ b/basis/io/files/info/info-docs.factor @@ -67,7 +67,7 @@ ARTICLE: "io.files.info" "File system metadata" { $subsections file-info link-info - exists? + file-exists? directory? regular-file? symbolic-link? diff --git a/basis/io/files/info/info.factor b/basis/io/files/info/info.factor index b920fc2435..a329835e09 100644 --- a/basis/io/files/info/info.factor +++ b/basis/io/files/info/info.factor @@ -12,12 +12,12 @@ accessed ; HOOK: file-info os ( path -- info ) : ?file-info ( path -- info/f ) - dup exists? [ file-info ] [ drop f ] if ; + dup file-exists? [ file-info ] [ drop f ] if ; HOOK: link-info os ( path -- info ) : ?link-info ( path -- info/f ) - dup exists? [ link-info ] [ drop f ] if ; + dup file-exists? [ link-info ] [ drop f ] if ; diff --git a/basis/io/files/unique/unique-tests.factor b/basis/io/files/unique/unique-tests.factor index 1a67edef8c..1ae9431967 100644 --- a/basis/io/files/unique/unique-tests.factor +++ b/basis/io/files/unique/unique-tests.factor @@ -32,7 +32,7 @@ io.pathnames kernel namespaces sequences strings tools.test ; { t } [ [ [ ] with-unique-directory - [ exists? ] [ delete-tree ] bi + [ file-exists? ] [ delete-tree ] bi ] with-temp-directory ] unit-test diff --git a/basis/io/files/windows/windows-tests.factor b/basis/io/files/windows/windows-tests.factor index d8784bdd11..c8003ac9ec 100644 --- a/basis/io/files/windows/windows-tests.factor +++ b/basis/io/files/windows/windows-tests.factor @@ -58,7 +58,7 @@ io.files.unique destructors ; ] unit-test [ "c:\\blah" ] [ "c:\\foo\\bar" "\\blah" append-path ] unit-test -[ t ] [ "" resource-path 2 tail exists? ] unit-test +[ t ] [ "" resource-path 2 tail file-exists? ] unit-test ! win32-file-attributes { diff --git a/basis/io/launcher/unix/unix-tests.factor b/basis/io/launcher/unix/unix-tests.factor index 4e34966f10..67aeee610e 100644 --- a/basis/io/launcher/unix/unix-tests.factor +++ b/basis/io/launcher/unix/unix-tests.factor @@ -8,7 +8,7 @@ IN: io.launcher.unix.tests [ { } [ { "touch" "launcher-test-1" } try-process ] unit-test - { t } [ "launcher-test-1" exists? ] unit-test + { t } [ "launcher-test-1" file-exists? ] unit-test { } [ "launcher-test-1" ?delete-file diff --git a/basis/io/monitors/monitors-tests.factor b/basis/io/monitors/monitors-tests.factor index ec250293cb..6fab7383e5 100644 --- a/basis/io/monitors/monitors-tests.factor +++ b/basis/io/monitors/monitors-tests.factor @@ -11,18 +11,18 @@ sequences threads tools.test ; { } [ "a2" make-directory ] unit-test { } [ "a1" "a2" move-file-into ] unit-test - { t } [ "a2/a1" exists? ] unit-test + { t } [ "a2/a1" file-exists? ] unit-test { } [ "a2/a1/a3.txt" touch-file ] unit-test - { t } [ "a2/a1/a3.txt" exists? ] unit-test + { t } [ "a2/a1/a3.txt" file-exists? ] unit-test { } [ "a2/a1/a4.txt" touch-file ] unit-test { } [ "a2/a1/a5.txt" touch-file ] unit-test { } [ "a2/a1/a4.txt" delete-file ] unit-test { } [ "a2/a1/a5.txt" "a2/a1/a4.txt" move-file ] unit-test - { t } [ "a2/a1/a4.txt" exists? ] unit-test + { t } [ "a2/a1/a4.txt" file-exists? ] unit-test { } [ "m" get dispose ] unit-test ] with-monitors diff --git a/basis/io/monitors/recursive/recursive-tests.factor b/basis/io/monitors/recursive/recursive-tests.factor index 0217314f55..fd632c5925 100644 --- a/basis/io/monitors/recursive/recursive-tests.factor +++ b/basis/io/monitors/recursive/recursive-tests.factor @@ -18,7 +18,7 @@ M: dummy-monitor dispose* M: mock-io-backend (monitor) nip - over exists? [ + over file-exists? [ dummy-monitor new-monitor dummy-monitor-created get [ 1 + ] change-i drop ] [ diff --git a/basis/io/sockets/secure/openssl/openssl.factor b/basis/io/sockets/secure/openssl/openssl.factor index daa9ebb6f1..ac3e0d179e 100644 --- a/basis/io/sockets/secure/openssl/openssl.factor +++ b/basis/io/sockets/secure/openssl/openssl.factor @@ -74,7 +74,7 @@ PRIVATE> ERROR: file-expected path ; : ensure-exists ( path -- path ) - dup exists? [ file-expected ] unless ; inline + dup file-exists? [ file-expected ] unless ; inline : ssl-file-path ( path -- path' ) absolute-path ensure-exists ; diff --git a/basis/io/standard-paths/unix/unix.factor b/basis/io/standard-paths/unix/unix.factor index 107f28a05a..288f9106d3 100644 --- a/basis/io/standard-paths/unix/unix.factor +++ b/basis/io/standard-paths/unix/unix.factor @@ -8,7 +8,7 @@ IN: io.standard-paths.unix M: unix find-in-path* [ "PATH" os-env ":" split ] dip - '[ _ append-path exists? ] find nip ; + '[ _ append-path file-exists? ] find nip ; ! iterm2 spews some terminal info on every bash command. : parse-login-paths ( seq -- strings ) @@ -21,4 +21,4 @@ M: unix find-in-path* binary stream-contents parse-login-paths ; M: unix find-in-standard-login-path* - [ standard-login-paths ] dip '[ _ append-path exists? ] find nip ; + [ standard-login-paths ] dip '[ _ append-path file-exists? ] find nip ; diff --git a/basis/io/standard-paths/windows/windows.factor b/basis/io/standard-paths/windows/windows.factor index eaab8c64ee..b98d327b32 100644 --- a/basis/io/standard-paths/windows/windows.factor +++ b/basis/io/standard-paths/windows/windows.factor @@ -24,4 +24,4 @@ M: windows find-in-applications M: windows find-in-path* [ "PATH" os-env ";" split ] dip - '[ _ append-path exists? ] find nip ; + '[ _ append-path file-exists? ] find nip ; diff --git a/basis/logging/parser/parser.factor b/basis/logging/parser/parser.factor index ecff2ef1d2..84d762b244 100644 --- a/basis/logging/parser/parser.factor +++ b/basis/logging/parser/parser.factor @@ -81,7 +81,7 @@ PEG: parse-log-line ( string -- entry ) log-line-parser ; ] { } make ; : parse-log-file ( service -- entries ) - log-path 1 log# dup exists? + log-path 1 log# dup file-exists? [ utf8 file-lines parse-log ] [ drop f ] if ; GENERIC: log-timestamp. ( date -- ) diff --git a/basis/logging/server/server.factor b/basis/logging/server/server.factor index de0cdd2b57..00cbf87400 100644 --- a/basis/logging/server/server.factor +++ b/basis/logging/server/server.factor @@ -72,7 +72,7 @@ CONSTANT: keep-logs 10 keep-logs log# ?delete-file ; : ?move-file ( old new -- ) - over exists? [ move-file ] [ 2drop ] if ; + over file-exists? [ move-file ] [ 2drop ] if ; : advance-log ( path n -- ) [ 1 - log# ] 2keep log# ?move-file ; diff --git a/basis/tools/completion/completion.factor b/basis/tools/completion/completion.factor index cebfcdb867..f5fe0836a3 100644 --- a/basis/tools/completion/completion.factor +++ b/basis/tools/completion/completion.factor @@ -122,7 +122,7 @@ PRIVATE> : paths-matching ( str -- seq ) dup last-path-separator [ 1 + cut ] [ drop "" ] if swap - dup { [ exists? ] [ file-info directory? ] } 1&& + dup { [ file-exists? ] [ file-info directory? ] } 1&& [ directory-paths completions ] [ 2drop { } ] if ; path - dup exists? [ directory-exists ] [ make-directories ] if ; + dup file-exists? [ directory-exists ] [ make-directories ] if ; : not-scaffolding ( path -- path ) "Not creating scaffolding for " write dup . ; @@ -68,7 +68,7 @@ ERROR: vocab-must-not-exist string ; "Creating scaffolding for " write dup . ; : scaffolding? ( path -- path ? ) - dup exists? [ not-scaffolding f ] [ scaffolding t ] if ; + dup file-exists? [ not-scaffolding f ] [ scaffolding t ] if ; : scaffold-copyright ( -- ) "! Copyright (C) " write now year>> number>string write diff --git a/basis/tools/which/which.factor b/basis/tools/which/which.factor index 4077002219..ee4fdb92f3 100644 --- a/basis/tools/which/which.factor +++ b/basis/tools/which/which.factor @@ -11,7 +11,7 @@ IN: tools.which : executable? ( path -- ? ) { - [ exists? ] + [ file-exists? ] [ file-executable? ] [ file-info directory? not ] } 1&& ; diff --git a/basis/ui/backend/gtk/gtk.factor b/basis/ui/backend/gtk/gtk.factor index 3446ff22f4..c9a46f99ea 100644 --- a/basis/ui/backend/gtk/gtk.factor +++ b/basis/ui/backend/gtk/gtk.factor @@ -186,7 +186,7 @@ icon-data [ default-icon-data ] initialize dup vocab-dir { "icon.png" "icon.ico" } [ append-path vocab-append-path ] 2with map default-icon-path suffix - [ exists? ] find nip binary file-contents ; + [ file-exists? ] find nip binary file-contents ; : load-icon ( -- ) icon-data get [ diff --git a/basis/vocabs/files/files.factor b/basis/vocabs/files/files.factor index 96bef7788b..2203de21c0 100644 --- a/basis/vocabs/files/files.factor +++ b/basis/vocabs/files/files.factor @@ -9,7 +9,7 @@ IN: vocabs.files : vocab-tests-dir ( vocab -- paths ) dup vocab-dir "tests" append-path vocab-append-path [ - dup exists? [ + dup file-exists? [ dup directory-files [ ".factor" tail? ] filter [ append-path ] with map ] [ drop f ] if @@ -18,7 +18,7 @@ IN: vocabs.files : vocab-tests ( vocab -- paths ) vocab-name ".private" ?tail drop [ - [ vocab-tests-path [ dup exists? [ , ] [ drop ] if ] when* ] + [ vocab-tests-path [ dup file-exists? [ , ] [ drop ] if ] when* ] [ vocab-tests-dir % ] bi ] { } make ; diff --git a/basis/vocabs/hierarchy/hierarchy.factor b/basis/vocabs/hierarchy/hierarchy.factor index 4ba44cc56d..f1edacca35 100644 --- a/basis/vocabs/hierarchy/hierarchy.factor +++ b/basis/vocabs/hierarchy/hierarchy.factor @@ -30,14 +30,14 @@ ERROR: vocab-root-required root ; : vocab-directory-entries ( root prefix -- vocab-path vocab-name entries ) ensure-vocab-root/prefix [ vocab-dir append-path ] keep - over dup exists? [ directory-entries ] [ drop { } ] if ; + over dup file-exists? [ directory-entries ] [ drop { } ] if ; : (disk-vocabs) ( root prefix -- seq ) vocab-directory-entries visible-dirs [ name>> [ dup ".factor" append append-path append-path ] [ over empty? [ nip ] [ "." glue ] if ] bi-curry bi* - swap exists? [ >vocab-link ] [ ] if + swap file-exists? [ >vocab-link ] [ ] if ] 2with map ; DEFER: add-vocab% diff --git a/basis/vocabs/metadata/metadata.factor b/basis/vocabs/metadata/metadata.factor index 30c37998a0..adbc1d4624 100644 --- a/basis/vocabs/metadata/metadata.factor +++ b/basis/vocabs/metadata/metadata.factor @@ -15,7 +15,7 @@ IN: vocabs.metadata MEMO: vocab-file-lines ( vocab name -- lines/f ) vocab-file-path dup [ - dup exists? [ + dup file-exists? [ utf8 file-lines harvest ] [ drop f @@ -98,17 +98,17 @@ TUPLE: unsupported-platform vocab requires ; M: unsupported-platform summary drop "Current operating system not supported by this vocabulary" ; -: exists?, ( path -- ) - [ dup exists? [ , ] [ drop ] if ] when* ; +: file-exists?, ( path -- ) + [ dup file-exists? [ , ] [ drop ] if ] when* ; : vocab-metadata-files ( vocab -- paths ) [ { - [ vocab-summary-path exists?, ] - [ vocab-authors-path exists?, ] - [ vocab-tags-path exists?, ] - [ vocab-platforms-path exists?, ] - [ vocab-resources-path exists?, ] + [ vocab-summary-path file-exists?, ] + [ vocab-authors-path file-exists?, ] + [ vocab-tags-path file-exists?, ] + [ vocab-platforms-path file-exists?, ] + [ vocab-resources-path file-exists?, ] } cleave ] { } make ; diff --git a/basis/vocabs/refresh/monitor/monitor.factor b/basis/vocabs/refresh/monitor/monitor.factor index 7e668daac1..26e77eee91 100644 --- a/basis/vocabs/refresh/monitor/monitor.factor +++ b/basis/vocabs/refresh/monitor/monitor.factor @@ -44,7 +44,7 @@ TR: convert-separators "/\\" ".." ; ] [ monitor-loop ] bi ; : (start-vocab-monitor) ( vocab-root -- ) - dup exists? + dup file-exists? [ [ t monitor-loop ] with-monitors ] [ drop ] if ; : start-vocab-monitor ( vocab-root -- ) diff --git a/basis/vocabs/refresh/refresh.factor b/basis/vocabs/refresh/refresh.factor index 948f2b1ac3..8de0f4892b 100644 --- a/basis/vocabs/refresh/refresh.factor +++ b/basis/vocabs/refresh/refresh.factor @@ -8,14 +8,14 @@ IN: vocabs.refresh : source-modified? ( path -- ? ) dup source-files get at [ dup path>> - dup exists? [ + dup file-exists? [ utf8 file-lines crc32 checksum-lines swap checksum>> = not ] [ 2drop f ] if ] [ - exists? + file-exists? ] ?if ; SYMBOL: changed-vocabs diff --git a/core/bootstrap/stage1.factor b/core/bootstrap/stage1.factor index 3404b8154a..54fef16d62 100644 --- a/core/bootstrap/stage1.factor +++ b/core/bootstrap/stage1.factor @@ -45,7 +45,7 @@ load-help? off init-resource-path "resource:basis/bootstrap/stage2.factor" - dup exists? [ + dup file-exists? [ run-file ] [ "Cannot find " write write "." print diff --git a/core/io/files/files-docs.factor b/core/io/files/files-docs.factor index 91a0fcab9d..afbba2ad32 100644 --- a/core/io/files/files-docs.factor +++ b/core/io/files/files-docs.factor @@ -111,6 +111,6 @@ HELP: file-contents { set-file-lines file-lines change-file-lines set-file-contents file-contents change-file-contents } related-words -HELP: exists? +HELP: file-exists? { $values { "path" "a pathname string" } { "?" boolean } } { $description "Tests if the file named by " { $snippet "path" } " exists." } ; diff --git a/core/io/files/files-tests.factor b/core/io/files/files-tests.factor index f87cd6eb82..2bcb67a977 100644 --- a/core/io/files/files-tests.factor +++ b/core/io/files/files-tests.factor @@ -160,7 +160,7 @@ CONSTANT: pt-array-1 { } [ "test.txt" "test2.txt" move-file ] unit-test - { t } [ "test2.txt" exists? ] unit-test + { t } [ "test2.txt" file-exists? ] unit-test { } [ "test2.txt" delete-file ] unit-test ] with-test-directory diff --git a/core/io/files/files.factor b/core/io/files/files.factor index 798d6d7dce..4c859b68f2 100644 --- a/core/io/files/files.factor +++ b/core/io/files/files.factor @@ -6,7 +6,7 @@ splitting system ; IN: io.files SYMBOL: +retry+ ! just try the operation again without blocking @@ -70,8 +70,10 @@ HOOK: (file-appender) io-backend ( path -- stream ) : with-file-appender ( path encoding quot -- ) [ ] dip with-output-stream ; inline -: exists? ( path -- ? ) - normalize-path native-string>alien (exists?) ; +: file-exists? ( path -- ? ) + normalize-path native-string>alien (file-exists?) ; + +ALIAS: exists? file-exists? ! Current directory > - [ path append-path exists? ] find nip + [ path append-path file-exists? ] find nip [ dup [ path append-path @@ -61,7 +61,7 @@ ERROR: header-file-missing path ; ] if* ; : read-local-include ( preprocessor-state path -- ) - dup exists? [ preprocess-file ] [ 2drop ] if ; + dup file-exists? [ preprocess-file ] [ 2drop ] if ; : skip-whitespace/comments ( sequence-parser -- sequence-parser ) skip-whitespace diff --git a/extra/combinators/extras/extras-tests.factor b/extra/combinators/extras/extras-tests.factor index 50fed8261c..5f1bdee9b7 100644 --- a/extra/combinators/extras/extras-tests.factor +++ b/extra/combinators/extras/extras-tests.factor @@ -34,9 +34,9 @@ splitting tools.test ; { "123" "1" } [ "1" "123" [ length ] [ < ] swap-when ] unit-test -{ t } [ "resource:" [ exists? ] ?1arg >boolean ] unit-test -{ f } [ f [ exists? ] ?1arg ] unit-test -{ f } [ "/homeasdfasdf123123" [ exists? ] ?1arg ] unit-test +{ t } [ "resource:" [ file-exists? ] ?1arg >boolean ] unit-test +{ f } [ f [ file-exists? ] ?1arg ] unit-test +{ f } [ "/homeasdfasdf123123" [ file-exists? ] ?1arg ] unit-test { "hi " "there" } [ "hi there" { diff --git a/extra/cpu/8080/emulator/emulator.factor b/extra/cpu/8080/emulator/emulator.factor index 8df417e207..5cbec86c99 100644 --- a/extra/cpu/8080/emulator/emulator.factor +++ b/extra/cpu/8080/emulator/emulator.factor @@ -453,7 +453,7 @@ SYMBOL: rom-root : rom-dir ( -- string ) rom-root get [ - home "roms" append-path dup exists? [ drop f ] unless + home "roms" append-path dup file-exists? [ drop f ] unless ] unless* ; : load-rom* ( seq cpu -- ) diff --git a/extra/fastcgi/fastcgi.factor b/extra/fastcgi/fastcgi.factor index d02d89728c..271451ca38 100644 --- a/extra/fastcgi/fastcgi.factor +++ b/extra/fastcgi/fastcgi.factor @@ -86,7 +86,7 @@ ENUM: fcgi-protocol-status ] loop ; : delete-if-exists ( file -- ) - dup exists? [ delete-file ] [ drop ] if ; + dup file-exists? [ delete-file ] [ drop ] if ; : make-local-socket ( socket-path -- socket ) [ delete-if-exists ] keep diff --git a/extra/gdbm/gdbm-docs.factor b/extra/gdbm/gdbm-docs.factor index db38308ad7..15e3c0b6d4 100644 --- a/extra/gdbm/gdbm-docs.factor +++ b/extra/gdbm/gdbm-docs.factor @@ -39,7 +39,7 @@ HELP: gdbm-error-message { $values { "error" gdbm-error } { "msg" string } } { $description "Returns error message in human readable format." } ; -HELP: exists? +HELP: file-exists? { $values { "key" object } { "?" boolean } } { $description "Searches for a particular key without retreiving it." } ; @@ -133,7 +133,7 @@ $nl "All interaction with gdbm database should be realized using special combinator which automates all work for database initialisation and cleanup. All initialisation options are passed to combinator with a database configuration object." { $subsections gdbm with-gdbm } "For actual record manipulation the following words are used:" -{ $subsections insert exists? fetch delete } +{ $subsections insert file-exists? fetch delete } { $heading "Sequential access" } "It is possible to iterate through all records in the database with" diff --git a/extra/gdbm/gdbm-tests.factor b/extra/gdbm/gdbm-tests.factor index f6782a35e8..1f6fea7508 100644 --- a/extra/gdbm/gdbm-tests.factor +++ b/extra/gdbm/gdbm-tests.factor @@ -18,7 +18,7 @@ CLEANUP test.db reader >>role [ ] with-gdbm ] [ gdbm-file-open-error = ] must-fail-with -{ f } [ [ "foo" exists? ] with-test.db ] unit-test +{ f } [ [ "foo" file-exists? ] with-test.db ] unit-test { } [ [ "foo" 41 insert ] with-test.db ] unit-test @@ -57,7 +57,7 @@ os macosx? [ { f } [ - test.db newdb >>role [ "foo" exists? ] with-gdbm + test.db newdb >>role [ "foo" file-exists? ] with-gdbm ] unit-test CLEANUP diff --git a/extra/gdbm/gdbm.factor b/extra/gdbm/gdbm.factor index f92d243a56..d05e1ee9ea 100644 --- a/extra/gdbm/gdbm.factor +++ b/extra/gdbm/gdbm.factor @@ -137,7 +137,7 @@ PRIVATE> : synchronize ( -- ) dbf gdbm_sync ; -: exists? ( key -- ? ) +: file-exists? ( key -- ? ) [ dbf swap object>datum gdbm_exists c-bool> ] with-destructors ; diff --git a/extra/gemini/cli/cli.factor b/extra/gemini/cli/cli.factor index 34b1fa0af2..de6291800c 100644 --- a/extra/gemini/cli/cli.factor +++ b/extra/gemini/cli/cli.factor @@ -124,7 +124,7 @@ CONSTANT: URL V{ } ] when* ; : gemini-less ( -- ) - "gemini.txt" temp-file dup exists? [ + "gemini.txt" temp-file dup file-exists? [ "less" swap 2array try-process ] [ drop ] if ; @@ -141,7 +141,7 @@ CONSTANT: URL V{ } URL ?first [ >url "/" >>path gemini-go ] when* ; : gemini-shell ( args -- ) - "|" split "gemini.txt" temp-file dup exists? [ + "|" split "gemini.txt" temp-file dup file-exists? [ "cat" swap 2array prefix run-pipeline drop ] [ 2drop ] if ; diff --git a/extra/gemini/server/server.factor b/extra/gemini/server/server.factor index 318183b1a7..977c3b9e9a 100644 --- a/extra/gemini/server/server.factor +++ b/extra/gemini/server/server.factor @@ -73,11 +73,11 @@ TUPLE: gemini-server < threaded-server ] with-directory-entries ; : send-directory ( server path -- ) - dup ".geminimap" append-path dup exists? [ + dup ".geminimap" append-path dup file-exists? [ send-file 2drop ] [ drop dup ".geminihead" append-path - dup exists? [ send-file ] [ drop ] if + dup file-exists? [ send-file ] [ drop ] if list-directory ] if ; diff --git a/extra/geo-ip/geo-ip.factor b/extra/geo-ip/geo-ip.factor index 4da5894179..cf814e5c5e 100644 --- a/extra/geo-ip/geo-ip.factor +++ b/extra/geo-ip/geo-ip.factor @@ -11,7 +11,7 @@ IN: geo-ip CONSTANT: db-url "http://software77.net/geo-ip/?DL=1" : download-db ( -- path ) - db-path dup exists? [ + db-path dup file-exists? [ db-url over ".gz" append download-to { "gunzip" } over ".gz" append absolute-path suffix try-process ] unless ; diff --git a/extra/git/git.factor b/extra/git/git.factor index 5705558282..80278f322f 100644 --- a/extra/git/git.factor +++ b/extra/git/git.factor @@ -60,7 +60,7 @@ ERROR: expected-one-line lines ; [ first ] [ expected-one-line ] if ; : git-unpacked-object-exists? ( hash -- ? ) - make-object-path exists? ; + make-object-path file-exists? ; TUPLE: index-entry ctime mtime dev ino mode uid gid size sha1 flags name ; CONSTRUCTOR: index-entry ( ctime mtime dev ino mode uid gid size sha1 flags name -- obj ) ; diff --git a/extra/gopher/server/server.factor b/extra/gopher/server/server.factor index b6f28aeb64..5eb6b403e0 100644 --- a/extra/gopher/server/server.factor +++ b/extra/gopher/server/server.factor @@ -83,11 +83,11 @@ TUPLE: gopher-server < threaded-server ] with-directory-entries ; : send-directory ( server path -- ) - dup ".gophermap" append-path dup exists? [ + dup ".gophermap" append-path dup file-exists? [ send-file 2drop ] [ drop dup ".gopherhead" append-path - dup exists? [ send-file ] [ drop ] if + dup file-exists? [ send-file ] [ drop ] if list-directory ] if ; diff --git a/extra/graphviz/graphviz-tests.factor b/extra/graphviz/graphviz-tests.factor index 70be570456..03f4710f6f 100644 --- a/extra/graphviz/graphviz-tests.factor +++ b/extra/graphviz/graphviz-tests.factor @@ -51,7 +51,7 @@ SYMBOLS: supported-layouts supported-formats ; ] with-test-directory ; : preview-smoke-test ( graph -- pass? ) - [ exists? ] with-preview ; + [ file-exists? ] with-preview ; : K_n ( n -- graph ) diff --git a/extra/graphviz/render/render.factor b/extra/graphviz/render/render.factor index ddbba2e772..4f2ed5a84a 100644 --- a/extra/graphviz/render/render.factor +++ b/extra/graphviz/render/render.factor @@ -72,7 +72,7 @@ M: cannot-find-graphviz-installation summary [ unsupported-encoding ] unless ; : ?delete-file ( path -- ) - dup exists? [ delete-file ] [ drop ] if ; + dup file-exists? [ delete-file ] [ drop ] if ; PRIVATE> diff --git a/extra/io/files/acls/macosx/macosx.factor b/extra/io/files/acls/macosx/macosx.factor index c26be9572c..b7dbc4b3f1 100644 --- a/extra/io/files/acls/macosx/macosx.factor +++ b/extra/io/files/acls/macosx/macosx.factor @@ -25,7 +25,7 @@ IN: io.files.acls.macosx clear-errno ACL_TYPE_EXTENDED acl_get_file dup [ errno ENOENT = [ - [ path exists? ] preserve-errno + [ path file-exists? ] preserve-errno [ drop f ] [ throw-errno ] if ] [ throw-errno diff --git a/extra/io/files/trash/unix/unix.factor b/extra/io/files/trash/unix/unix.factor index 730de60c0f..ce1f7a920a 100644 --- a/extra/io/files/trash/unix/unix.factor +++ b/extra/io/files/trash/unix/unix.factor @@ -44,7 +44,7 @@ IN: io.files.trash.unix top-directory dup trash-home top-directory = [ drop trash-home ] [ - dup ".Trash" append-path exists? + dup ".Trash" append-path file-exists? [ trash-1 ] [ trash-2 ] if [ make-user-directory ] keep ] if ; @@ -57,7 +57,7 @@ IN: io.files.trash.unix ] dip swap "%s%s %s%s" sprintf ; : safe-file-name ( path -- path' ) - dup 0 [ over exists? ] [ + dup 0 [ over file-exists? ] [ [ parent-directory to-directory ] [ 1 + ] bi* [ (safe-file-name) ] keep ] while drop nip ; diff --git a/extra/machine-learning/data-sets/data-sets.factor b/extra/machine-learning/data-sets/data-sets.factor index 2d38cb4c39..0770d1a0b1 100644 --- a/extra/machine-learning/data-sets/data-sets.factor +++ b/extra/machine-learning/data-sets/data-sets.factor @@ -68,7 +68,7 @@ PRIVATE> : download-to-directory ( url directory -- ) dup make-directories [ - dup { [ download-name exists? ] [ file-stem exists? ] } 1|| [ + dup { [ download-name file-exists? ] [ file-stem file-exists? ] } 1|| [ drop ] [ download @@ -107,7 +107,7 @@ PRIVATE> "http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz" } [ [ "resource:datasets/" download-to-directory ] parallel-each ] - [ [ dup file-stem exists? [ drop ] [ file-name gzip-decompress-file ] if ] each ] + [ [ dup file-stem file-exists? [ drop ] [ file-name gzip-decompress-file ] if ] each ] [ [ file-stem binary file-contents ] map ] tri first4 { [ mnist-data>array ] diff --git a/extra/mason/cleanup/cleanup.factor b/extra/mason/cleanup/cleanup.factor index 2b42de1bbe..1828199141 100644 --- a/extra/mason/cleanup/cleanup.factor +++ b/extra/mason/cleanup/cleanup.factor @@ -5,7 +5,7 @@ mason.config mason.platform namespaces ; IN: mason.cleanup : compress ( filename -- ) - dup exists? [ + dup file-exists? [ "bzip2" swap 2array short-running-process ] [ drop ] if ; diff --git a/extra/mason/git/git.factor b/extra/mason/git/git.factor index 1d3c88503d..6cdcd5fe8a 100644 --- a/extra/mason/git/git.factor +++ b/extra/mason/git/git.factor @@ -78,7 +78,7 @@ PRIVATE> : git-clone-or-pull ( -- id ) ! Must be run from builds-dir. - "factor" exists? [ + "factor" file-exists? [ check-repository [ "factor" [ [ git-pull-cmd short-running-process ] diff --git a/extra/mason/release/tidy/tidy.factor b/extra/mason/release/tidy/tidy.factor index ed791b36d7..5e8724b9f6 100644 --- a/extra/mason/release/tidy/tidy.factor +++ b/extra/mason/release/tidy/tidy.factor @@ -34,6 +34,6 @@ CONSTANT: cleanup-list { : tidy ( -- ) "factor" [ useless-files - [ exists? ] filter + [ file-exists? ] filter [ delete-tree ] each ] with-directory ; diff --git a/extra/mason/report/report-tests.factor b/extra/mason/report/report-tests.factor index 6f5efe3c1b..9cdd1e3270 100644 --- a/extra/mason/report/report-tests.factor +++ b/extra/mason/report/report-tests.factor @@ -5,7 +5,7 @@ IN: mason.report.tests { 0 0 } [ [ ] with-report ] must-infer-as : verify-report ( -- ) - [ t ] [ "report" exists? ] unit-test + [ t ] [ "report" file-exists? ] unit-test [ ] [ "report" file>xml drop ] unit-test [ ] [ "report" delete-file ] unit-test ; diff --git a/extra/modern/paths/paths.factor b/extra/modern/paths/paths.factor index a6e46ebde0..b43526d68e 100644 --- a/extra/modern/paths/paths.factor +++ b/extra/modern/paths/paths.factor @@ -43,7 +43,7 @@ CONSTANT: core-broken-vocabs extra-vocabs ] { } append-outputs-as ; -: filter-exists ( seq -- seq' ) [ exists? ] filter ; +: filter-exists ( seq -- seq' ) [ file-exists? ] filter ; ! These paths have syntax errors on purpose... : reject-some-paths ( seq -- seq' ) diff --git a/extra/project-euler/041/041.factor b/extra/project-euler/041/041.factor index 5bf7075208..4074f75afb 100644 --- a/extra/project-euler/041/041.factor +++ b/extra/project-euler/041/041.factor @@ -12,7 +12,7 @@ IN: project-euler.041 ! digits 1 to n exactly once. For example, 2143 is a 4-digit pandigital and is ! also prime. -! What is the largest n-digit pandigital prime that exists? +! What is the largest n-digit pandigital prime that file-exists? ! SOLUTION diff --git a/extra/protocols/tftp/tftp.factor b/extra/protocols/tftp/tftp.factor index 72a609389c..cebd82aeb8 100644 --- a/extra/protocols/tftp/tftp.factor +++ b/extra/protocols/tftp/tftp.factor @@ -74,7 +74,7 @@ TUPLE: read-file path encoding block ; : handle-send-file ( bytes -- ) "\0" split harvest first2 [ utf8 decode ] bi@ - over { [ exists? ] [ file-info directory? not ] } 1&& [ + over { [ file-exists? ] [ file-info directory? not ] } 1&& [ "netascii" sequence= utf8 binary ? 0 read-file boa tftp-client get clients get set-at 0 handle-send-file-next diff --git a/extra/rosetta-code/text-processing/max-licenses/max-licenses.factor b/extra/rosetta-code/text-processing/max-licenses/max-licenses.factor index 25a0d94f1e..1fdac5293f 100644 --- a/extra/rosetta-code/text-processing/max-licenses/max-licenses.factor +++ b/extra/rosetta-code/text-processing/max-licenses/max-licenses.factor @@ -62,7 +62,7 @@ TUPLE: maxlicense max-count current-count times ; : process ( max line -- max ) split-line inc-current-count update-time ; MEMO: mlijobs ( -- lines ) - "mlijobs.txt" temp-file dup exists? [ + "mlijobs.txt" temp-file dup file-exists? [ URL" http://rosettacode.org/resources/mlijobs.txt" over download-to ] unless ascii file-lines ; diff --git a/extra/terminfo/terminfo.factor b/extra/terminfo/terminfo.factor index 156ca33be1..f2c6ff57d1 100644 --- a/extra/terminfo/terminfo.factor +++ b/extra/terminfo/terminfo.factor @@ -85,7 +85,7 @@ M: linux terminfo-relative-path ( name -- path ) : terminfo-path ( name -- path ) terminfo-relative-path TERMINFO-DIRS [ swap append-path ] with map - [ exists? ] find nip ; + [ file-exists? ] find nip ; : terminfo-names-for-path ( path -- names ) [ @@ -94,7 +94,7 @@ M: linux terminfo-relative-path ( name -- path ) ] with-directory-entries ; MEMO: terminfo-names ( -- names ) - TERMINFO-DIRS [ exists? ] filter + TERMINFO-DIRS [ file-exists? ] filter [ terminfo-names-for-path ] map concat ; json ; diff --git a/extra/tools/cat/cat.factor b/extra/tools/cat/cat.factor index 45694598df..bd0ab86733 100644 --- a/extra/tools/cat/cat.factor +++ b/extra/tools/cat/cat.factor @@ -12,7 +12,7 @@ IN: tools.cat '[ _ stream-write ] each-stream-block ; : cat-file ( path -- ) - dup exists? [ + dup file-exists? [ binary [ cat-stream ] with-file-reader ] [ "%s: not found\n" printf flush ] if ; diff --git a/extra/tools/copy/copy.factor b/extra/tools/copy/copy.factor index cf2dbd853a..523e121287 100644 --- a/extra/tools/copy/copy.factor +++ b/extra/tools/copy/copy.factor @@ -15,7 +15,7 @@ IN: tools.copy [ unclip-last copy-files-into ] [ drop usage ] if ; : copy-to-file ( args -- ) - dup last { [ exists? ] [ file-info directory? ] } 1&& + dup last { [ file-exists? ] [ file-info directory? ] } 1&& [ copy-to-dir ] [ first2 copy-file ] if ; : run-copy ( -- ) diff --git a/extra/tools/image-analyzer/graphviz/graphviz-tests.factor b/extra/tools/image-analyzer/graphviz/graphviz-tests.factor index f65125b413..d941b36d95 100644 --- a/extra/tools/image-analyzer/graphviz/graphviz-tests.factor +++ b/extra/tools/image-analyzer/graphviz/graphviz-tests.factor @@ -8,7 +8,7 @@ IN: tools.image-analyzer.graphviz.tests boot-image-name resource-path ; : ?make-image ( arch -- ) - dup boot-image-path exists? [ drop ] [ make-image ] if ; + dup boot-image-path file-exists? [ drop ] [ make-image ] if ; : loadable-images ( -- images ) image-names cpu name>> '[ _ tail? ] filter ; diff --git a/extra/tools/image-analyzer/image-analyzer-tests.factor b/extra/tools/image-analyzer/image-analyzer-tests.factor index 0c17563623..882bf2ba5e 100644 --- a/extra/tools/image-analyzer/image-analyzer-tests.factor +++ b/extra/tools/image-analyzer/image-analyzer-tests.factor @@ -6,7 +6,7 @@ IN: tools.image-analyzer.tests boot-image-name resource-path ; : ?make-image ( arch -- ) - dup boot-image-path exists? [ drop ] [ make-image ] if ; + dup boot-image-path file-exists? [ drop ] [ make-image ] if ; : loadable-images ( -- images ) image-names cpu name>> '[ _ tail? ] filter ; diff --git a/extra/webapps/imagebin/imagebin.factor b/extra/webapps/imagebin/imagebin.factor index e9fc2c742f..44027b88ae 100644 --- a/extra/webapps/imagebin/imagebin.factor +++ b/extra/webapps/imagebin/imagebin.factor @@ -20,7 +20,7 @@ M: imagebin call-responder* [ imagebin set ] [ call-next-method ] bi ; : move-image ( mime-file -- ) - [ next-image-path dup exists? ] [ drop ] while + [ next-image-path dup file-exists? ] [ drop ] while [ [ temporary-path>> ] dip move-file ] [ [ filename>> ] dip ".txt" append utf8 set-file-contents ] 2bi ; diff --git a/extra/webapps/mason/docs-update/docs-update.factor b/extra/webapps/mason/docs-update/docs-update.factor index 438e916d3e..d28ea88fa8 100644 --- a/extra/webapps/mason/docs-update/docs-update.factor +++ b/extra/webapps/mason/docs-update/docs-update.factor @@ -11,16 +11,16 @@ IN: webapps.mason.docs-update : update-docs ( -- ) home [ - "newdocs" exists? [ "newdocs" delete-tree ] when + "newdocs" file-exists? [ "newdocs" delete-tree ] when "newdocs" make-directory "newdocs" [ { "tar" "xfz" } docs-path suffix try-process ] with-directory - "docs" exists? [ "docs" "docs.old" move-file ] when + "docs" file-exists? [ "docs" "docs.old" move-file ] when "newdocs/docs" "docs" move-file "newdocs" delete-directory - "docs.old" exists? [ "docs.old" delete-tree ] when + "docs.old" file-exists? [ "docs.old" delete-tree ] when \ load-index reset-memoized ] with-directory ; diff --git a/misc/vim/syntax/factor/generated.vim b/misc/vim/syntax/factor/generated.vim index cda2a58d2a..2f4f42ec54 100644 --- a/misc/vim/syntax/factor/generated.vim +++ b/misc/vim/syntax/factor/generated.vim @@ -33,7 +33,7 @@ SynKeywordFactorWord factorWord_io | syn keyword factorWord_io contained (each-s SynKeywordFactorWord factorWord_io_encodings | syn keyword factorWord_io_encodings contained (decode-until) decode-char decode-error decode-error? decode-input decode-until decoder decoder? encode-char encode-error encode-error? encode-output encode-string encoder encoder? guess-decoded-length guess-encoded-length re-decode re-encode replacement-char with-decoded-input with-encoded-output SynKeywordFactorWord factorWord_io_encodings_binary | syn keyword factorWord_io_encodings_binary contained binary binary? SynKeywordFactorWord factorWord_io_encodings_utf8 | syn keyword factorWord_io_encodings_utf8 contained >utf8-index code-point-length code-point-offsets utf8 utf8-index> utf8? -SynKeywordFactorWord factorWord_io_files | syn keyword factorWord_io_files contained (file-appender) (file-reader) (file-writer) +input+ +output+ +retry+ change-file-contents change-file-lines drain exists? file-contents file-lines file-reader file-reader? file-writer file-writer? init-resource-path refill set-file-contents set-file-lines wait-for-fd with-file-appender with-file-reader with-file-writer +SynKeywordFactorWord factorWord_io_files | syn keyword factorWord_io_files contained (file-appender) (file-reader) (file-writer) +input+ +output+ +retry+ change-file-contents change-file-lines drain file-exists? file-contents file-lines file-reader file-reader? file-writer file-writer? init-resource-path refill set-file-contents set-file-lines wait-for-fd with-file-appender with-file-reader with-file-writer SynKeywordFactorWord factorWord_kernel | syn keyword factorWord_kernel contained (clone) -roll -rot -rotd 2bi 2bi* 2bi@ 2curry 2dip 2drop 2dup 2keep 2keepd 2nip 2nipd 2over 2tri 2tri* 2tri@ 2with 3bi 3curry 3dip 3drop 3dup 3keep 3nip 3nipd 3tri 4dip 4drop 4dup 4keep 4nip 5drop 5nip = >boolean ? ?if and assert assert= assert? bi bi* bi-curry bi-curry* bi-curry@ bi@ boa boolean boolean? both? build call callstack callstack>array callstack? clear clone compose composed composed? curried curried? curry die dip do drop dup dupd either? eq? equal? execute get-callstack get-datastack get-retainstack hashcode hashcode* identity-hashcode identity-tuple identity-tuple? if if* keep keepd keepdd loop most new nip nipd not null object or over overd pick pickd prepose reach recursive-hashcode roll rot rotd same? spin swap swapd throw tri tri* tri-curry tri-curry* tri-curry@ tri@ tuck tuple tuple? unless unless* until when when* while while* with wrapper wrapper? xor SynKeywordFactorWord factorWord_layouts | syn keyword factorWord_layouts contained (first-bignum) (fixnum-bits) (max-array-capacity) 32bit? 64bit? bootstrap-cell bootstrap-cell-bits bootstrap-cells bootstrap-first-bignum bootstrap-fixnum-bits bootstrap-max-array-capacity bootstrap-most-negative-fixnum bootstrap-most-positive-fixnum cell cell-bits cells data-alignment first-bignum fixnum-bits hashcode-shift header-bits immediate immediate? leaf-stack-frame-size max-array-capacity mega-cache-size most-negative-fixnum most-positive-fixnum num-types tag-bits tag-fixnum tag-header tag-mask type-number type-numbers untag-fixnum SynKeywordFactorWord factorWord_make | syn keyword factorWord_make contained % %% , ,+ ,, building make -- 2.34.1