io.files: rename the *-to words to *-into
parent
b353363c9f
commit
c5f5e0a61a
|
@ -57,8 +57,8 @@ ARTICLE: "delete-move-copy" "Deleting, moving, copying files"
|
||||||
"The operations for moving and copying files come in three flavors:"
|
"The operations for moving and copying files come in three flavors:"
|
||||||
{ $list
|
{ $list
|
||||||
{ "A word named " { $snippet { $emphasis "operation" } } " which takes a source and destination path." }
|
{ "A word named " { $snippet { $emphasis "operation" } } " which takes a source and destination path." }
|
||||||
{ "A word named " { $snippet { $emphasis "operation" } "-to" } " which takes a source path and destination directory. The destination file will be stored in the destination directory and will have the same file name as the source path." }
|
{ "A word named " { $snippet { $emphasis "operation" } "-into" } " which takes a source path and destination directory. The destination file will be stored in the destination directory and will have the same file name as the source path." }
|
||||||
{ "A word named " { $snippet { $emphasis "operation" } "s-to" } " which takes a sequence of source paths and destination directory." }
|
{ "A word named " { $snippet { $emphasis "operation" } "s-into" } " which takes a sequence of source paths and destination directory." }
|
||||||
}
|
}
|
||||||
"Since both of the above lists apply to copying files, that this means that there are a total of six variations on copying a file."
|
"Since both of the above lists apply to copying files, that this means that there are a total of six variations on copying a file."
|
||||||
$nl
|
$nl
|
||||||
|
@ -68,16 +68,16 @@ $nl
|
||||||
{ $subsection delete-tree }
|
{ $subsection delete-tree }
|
||||||
"Moving files:"
|
"Moving files:"
|
||||||
{ $subsection move-file }
|
{ $subsection move-file }
|
||||||
{ $subsection move-file-to }
|
{ $subsection move-file-into }
|
||||||
{ $subsection move-files-to }
|
{ $subsection move-files-into }
|
||||||
"Copying files:"
|
"Copying files:"
|
||||||
{ $subsection copy-file }
|
{ $subsection copy-file }
|
||||||
{ $subsection copy-file-to }
|
{ $subsection copy-file-into }
|
||||||
{ $subsection copy-files-to }
|
{ $subsection copy-files-into }
|
||||||
"Copying directory trees recursively:"
|
"Copying directory trees recursively:"
|
||||||
{ $subsection copy-tree }
|
{ $subsection copy-tree }
|
||||||
{ $subsection copy-tree-to }
|
{ $subsection copy-tree-into }
|
||||||
{ $subsection copy-trees-to }
|
{ $subsection copy-trees-into }
|
||||||
"On most operating systems, files can only be moved within the same file system. To move files between file systems, use " { $link copy-file } " followed by " { $link delete-file } " on the old name." ;
|
"On most operating systems, files can only be moved within the same file system. To move files between file systems, use " { $link copy-file } " followed by " { $link delete-file } " on the old name." ;
|
||||||
|
|
||||||
ARTICLE: "io.files" "Basic file operations"
|
ARTICLE: "io.files" "Basic file operations"
|
||||||
|
@ -267,12 +267,12 @@ HELP: move-file
|
||||||
{ $description "Moves or renames a file." }
|
{ $description "Moves or renames a file." }
|
||||||
{ $errors "Throws an error if the file does not exist or if the move operation fails." } ;
|
{ $errors "Throws an error if the file does not exist or if the move operation fails." } ;
|
||||||
|
|
||||||
HELP: move-file-to
|
HELP: move-file-into
|
||||||
{ $values { "from" "a pathname string" } { "to" "a directory pathname string" } }
|
{ $values { "from" "a pathname string" } { "to" "a directory pathname string" } }
|
||||||
{ $description "Moves a file to another directory without renaming it." }
|
{ $description "Moves a file to another directory without renaming it." }
|
||||||
{ $errors "Throws an error if the file does not exist or if the move operation fails." } ;
|
{ $errors "Throws an error if the file does not exist or if the move operation fails." } ;
|
||||||
|
|
||||||
HELP: move-files-to
|
HELP: move-files-into
|
||||||
{ $values { "files" "a sequence of pathname strings" } { "to" "a directory pathname string" } }
|
{ $values { "files" "a sequence of pathname strings" } { "to" "a directory pathname string" } }
|
||||||
{ $description "Moves a set of files to another directory." }
|
{ $description "Moves a set of files to another directory." }
|
||||||
{ $errors "Throws an error if the file does not exist or if the move operation fails." } ;
|
{ $errors "Throws an error if the file does not exist or if the move operation fails." } ;
|
||||||
|
@ -283,12 +283,12 @@ HELP: copy-file
|
||||||
{ $notes "This operation attempts to preserve the original file's attributes, however not all attributes may be preserved." }
|
{ $notes "This operation attempts to preserve the original file's attributes, however not all attributes may be preserved." }
|
||||||
{ $errors "Throws an error if the file does not exist or if the copy operation fails." } ;
|
{ $errors "Throws an error if the file does not exist or if the copy operation fails." } ;
|
||||||
|
|
||||||
HELP: copy-file-to
|
HELP: copy-file-into
|
||||||
{ $values { "from" "a pathname string" } { "to" "a directory pathname string" } }
|
{ $values { "from" "a pathname string" } { "to" "a directory pathname string" } }
|
||||||
{ $description "Copies a file to another directory." }
|
{ $description "Copies a file to another directory." }
|
||||||
{ $errors "Throws an error if the file does not exist or if the copy operation fails." } ;
|
{ $errors "Throws an error if the file does not exist or if the copy operation fails." } ;
|
||||||
|
|
||||||
HELP: copy-files-to
|
HELP: copy-files-into
|
||||||
{ $values { "files" "a sequence of pathname strings" } { "to" "a directory pathname string" } }
|
{ $values { "files" "a sequence of pathname strings" } { "to" "a directory pathname string" } }
|
||||||
{ $description "Copies a set of files to another directory." }
|
{ $description "Copies a set of files to another directory." }
|
||||||
{ $errors "Throws an error if the file does not exist or if the copy operation fails." } ;
|
{ $errors "Throws an error if the file does not exist or if the copy operation fails." } ;
|
||||||
|
@ -299,12 +299,12 @@ HELP: copy-tree
|
||||||
{ $notes "This operation attempts to preserve original file attributes, however not all attributes may be preserved." }
|
{ $notes "This operation attempts to preserve original file attributes, however not all attributes may be preserved." }
|
||||||
{ $errors "Throws an error if the copy operation fails." } ;
|
{ $errors "Throws an error if the copy operation fails." } ;
|
||||||
|
|
||||||
HELP: copy-tree-to
|
HELP: copy-tree-into
|
||||||
{ $values { "from" "a pathname string" } { "to" "a directory pathname string" } }
|
{ $values { "from" "a pathname string" } { "to" "a directory pathname string" } }
|
||||||
{ $description "Copies a directory tree to another directory, recursively." }
|
{ $description "Copies a directory tree to another directory, recursively." }
|
||||||
{ $errors "Throws an error if the copy operation fails." } ;
|
{ $errors "Throws an error if the copy operation fails." } ;
|
||||||
|
|
||||||
HELP: copy-trees-to
|
HELP: copy-trees-into
|
||||||
{ $values { "files" "a sequence of pathname strings" } { "to" "a directory pathname string" } }
|
{ $values { "files" "a sequence of pathname strings" } { "to" "a directory pathname string" } }
|
||||||
{ $description "Copies a set of directory trees to another directory, recursively." }
|
{ $description "Copies a set of directory trees to another directory, recursively." }
|
||||||
{ $errors "Throws an error if the copy operation fails." } ;
|
{ $errors "Throws an error if the copy operation fails." } ;
|
||||||
|
|
|
@ -137,37 +137,37 @@ HOOK: delete-directory io-backend ( path -- )
|
||||||
! Moving and renaming files
|
! Moving and renaming files
|
||||||
HOOK: move-file io-backend ( from to -- )
|
HOOK: move-file io-backend ( from to -- )
|
||||||
|
|
||||||
: move-file-to ( from to -- )
|
: move-file-into ( from to -- )
|
||||||
to-directory move-file ;
|
to-directory move-file ;
|
||||||
|
|
||||||
: move-files-to ( files to -- )
|
: move-files-into ( files to -- )
|
||||||
[ move-file-to ] curry each ;
|
[ move-file-into ] curry each ;
|
||||||
|
|
||||||
! Copying files
|
! Copying files
|
||||||
HOOK: copy-file io-backend ( from to -- )
|
HOOK: copy-file io-backend ( from to -- )
|
||||||
|
|
||||||
: copy-file-to ( from to -- )
|
: copy-file-into ( from to -- )
|
||||||
to-directory copy-file ;
|
to-directory copy-file ;
|
||||||
|
|
||||||
: copy-files-to ( files to -- )
|
: copy-files-into ( files to -- )
|
||||||
[ copy-file-to ] curry each ;
|
[ copy-file-into ] curry each ;
|
||||||
|
|
||||||
DEFER: copy-tree-to
|
DEFER: copy-tree-into
|
||||||
|
|
||||||
: copy-tree ( from to -- )
|
: copy-tree ( from to -- )
|
||||||
over directory? [
|
over directory? [
|
||||||
>r dup directory swap r> [
|
>r dup directory swap r> [
|
||||||
>r swap first path+ r> copy-tree-to
|
>r swap first path+ r> copy-tree-into
|
||||||
] 2curry each
|
] 2curry each
|
||||||
] [
|
] [
|
||||||
copy-file
|
copy-file
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
: copy-tree-to ( from to -- )
|
: copy-tree-into ( from to -- )
|
||||||
to-directory copy-tree ;
|
to-directory copy-tree ;
|
||||||
|
|
||||||
: copy-trees-to ( files to -- )
|
: copy-trees-into ( files to -- )
|
||||||
[ copy-tree-to ] curry each ;
|
[ copy-tree-into ] curry each ;
|
||||||
|
|
||||||
! Special paths
|
! Special paths
|
||||||
: resource-path ( path -- newpath )
|
: resource-path ( path -- newpath )
|
||||||
|
|
Loading…
Reference in New Issue