Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
[[tags: egg]] == directory-utils [[toc:]] == Documentation ==== Type Checks ==== Usage <enscript language=scheme> (import (directory-utils checks)) </enscript> ==== dirname? ==== check-dirname ==== error-dirname <procedure>(dirname? OBJ) -> boolean</procedure> <procedure>(check-dirname LOCATION OBJECT [ARGNAM]) -> dirname</procedure> <procedure>(error-dirname LOCATION OBJECT [ARGNAM])</procedure> ==== check-directory ==== error-directory <procedure>(check-directory LOCATION OBJECT [ARGNAM]) -> directoryname</procedure> <procedure>(error-directory LOCATION OBJECT [ARGNAM])</procedure> Does the {{OBJECT}} name an existing {{directory}}> Does not reexport {{(chicken file posix) directory?}}. ==== pathname? ==== check-pathname ==== error-pathname <procedure>(pathname? OBJ) -> boolean</procedure> <procedure>(check-pathname LOCATION OBJECT [ARGNAM]) -> pathname</procedure> <procedure>(error-pathname LOCATION OBJECT [ARGNAM])</procedure> Does not verify existence of the file, just whether the pathname has a directory and/or file component. ==== filename? ==== check-filename ==== error-filename <procedure>(filename? OBJ) -> boolean</procedure> <procedure>(check-filename LOCATION OBJECT [ARGNAM]) -> filename</procedure> <procedure>(error-filename LOCATION OBJECT [ARGNAM])</procedure> Does not verify existence of the file, just whether it has a directory component. === Dotted Files & Directories Does not verify the existence of the subject directory or file. ==== Usage <enscript language=scheme> (import (directory-utils dotted)) </enscript> ==== dot-prefix-dirname? <procedure>(dot-prefix-dirname? DIRNAME) -> boolean</procedure> {{DIRNAME}} begins with a {{dot-prefix-dirname?}} ==== dot-suffix-dirname? <procedure>(dot-suffix-dirname? DIRNAME) -> boolean</procedure> {{DIRNAME}} ends with a {{dot-prefix-dirname?}} ==== dot-filename? <procedure>(dot-filename? FILENAME) -> boolean</procedure> Does the {{FILENAME}} name a file with a dot-name? ==== dot-pathname? <procedure>(dot-pathname? PATHNAME) -> boolean</procedure> Is any directory in the {{PATHNAME}} a dot-filename? Does not verify existence of the file! ==== remove-dotfiles <procedure>(remove-dotfiles FILES)</procedure> Remove dot files from a directory list. Useful with glob. ==== Directory Operations ==== Usage <enscript language=scheme> (import (directory-utils operations)) </enscript> ==== directory-foldl <procedure>(directory-foldl DIRECTORY FUNCTION SEED [SHOW-DOTFILES?]) -> *</procedure> Invokes {{FUNCTION}} on the recursive value from {{SEED}} and each {{filename}} in the {{DIRECTORY}} and . Returns the final value. ; {{FUNCTION}} : {{(* filename -> *)}}. ; {{SHOW-DOTFILES?}} : {{boolean}} ; include files with a {{"."}} prefix ; Default {{#f}}. ''Note'' that only the {{filename}} is passed and not the complete {{pathname}}. The {{"."}} and {{".."}} filenames are not supplied no matter the {{SHOW-DOTFILES?}} setting. On a ''Windows'' platform hidden files have a {{hidden}} attribute so this routine is rather ''*nix'' centric. ==== directory-unfold <procedure>(directory-unfold DIRECTORY TEST NEXT SEED [SHOW-DOTFILES?]) -> *</procedure> Walks {{DIRECTORY}}, visiting subdirectories based on {{TEST}}, and calling {{NEXT}} on the recursive value from {{SEED}} and each {{pathname}} in the directories. Returns the final value. Directories for which {{TEST}} fails are handled by {{NEXT}}. The passed {{pathname}} is a directory-separator suffixed {{dirname}}; example {{"b/"}}. ; {{TEST}} : {{(pathname -> 'a}} ; called with the full pathname. ; {{NEXT}} : {{('a pathname -> 'a)}} ; called with the full pathname. ; {{SEED}} : {{'a}}. ; {{SHOW-DOTFILES?}} : {{boolean}} ; include files with a {{"."}} prefix ; Default {{#f}}. ==== create-pathname-directory <procedure>(create-pathname-directory PATHNAME)</procedure> Ensures the directory component of {{PATHNAME}} exist. Like the ''*nix'' `"mkdir -p `dirname PATHNAME`" command. ==== make-program-filename <procedure>(make-program-filename COMMAND) -> *</procedure> Returns the platform specific form of an executable command filename. On ''Windows'' the {{"exe"}} extension is added unless an extension is already present. Does nothing otherwise. ==== make-shell-filename <procedure>(make-shell-filename COMMAND) -> *</procedure> Returns the platform specific form of a shell command filename. On ''Windows'' the {{"bat"}} extension is added unless an extension is already present. Otherwise conditionally adds the {{"sh"}} extension. ==== file-exists-in-directory? <procedure>(file-exists-in-directory? FILENAME [DIRECTORY ...]) -> (or #f pathname)</procedure> Returns the pathname when {{FILENAME}} exists in the {{DIRECTORY ...}}, otherwise #f. {{DIRECTORY ...}} as make-pathname. When only the {{FILENAME}} argument supplied then the same as file-exists?. ==== find-file-pathnames <procedure>(find-file-pathnames FILENAME [DIRECTORY | DIRECTORY-LIST] ...) -> (or #f (list-of pathname))</procedure> Returns a list of all pathnames found for {{FILENAME}} in the supplied directory/directories, or #f when not found. The list of pathnames is in the same relative order as that of the directory parameter(s). ==== find-program-pathnames <procedure>(find-program-pathnames COMMAND-NAME [DIRECTORY | DIRECTORY-LIST] ...) -> (or #f (list-of pathname))</procedure> Returns a list of all pathnames found for {{COMMAND-NAME}} in the supplied directory/directories, or #f when not found. Uses make-program-filename to make a filename. On ''Windows'' also uses make-shell-filename to make a filename. Does not ensure that the file is executable! ==== find-command-pathnames <procedure>(find-command-pathnames COMMAND-NAME [ENVIRONMENT-VARIABLE]) -> (or #f (list-of pathname))</procedure> Returns the pathnames of {{COMMAND-NAME}} in the {{ENVIRONMENT-VARIABLE}} where the file exists, or #f when nothing found. The default {{ENVIRONMENT-VARIABLE}} is "PATH". Uses the platform specific "PATH" environment variable element separator - a ''Windows'' {{#\;}}, and a ''*nix'' {{#\:}}. ==== which-command-pathname <procedure>(which-command-pathname COMMAND-NAME [ENVIRONMENT-VARIABLE]) -> (or #f pathname)</procedure> Same as which-command-pathnames but returns the first pathname only. Like the ''*nix'' `which COMMAND-NAME` command. === Directory Stack === Usage <enscript language=scheme> (import (directory-utils stack)) </enscript> ==== directory-utility-stack <parameter>(directory-utility-stack [STACK]) -> stack</parameter> Which {{stack}} to use for directory stack operations. {{stack}} is from [[stack]]. ==== push-directory <procedure>(push-directory DIRECTORY [STACK])</procedure> Push the current directory and change to the {{DIRECTORY}}. ; {{DIRECTORY}} : {{string}} ; pathname ; {{STACK}} : {{stack}} ; optional; default {{(directory-utility-stack)}} ==== pop-directory <procedure>(pop-directory [STACK]) -> string</procedure> Pop the last directory and change to it. ; {{STACK}} : {{stack}} ; optional; default {{(directory-utility-stack)}} ==== pop-toplevel-directory <procedure>(pop-toplevel-directory [STACK]) -> string</procedure> Pop the earliest directory and change to it. ; {{STACK}} : {{stack}} ; optional; default {{(directory-utility-stack)}} == Requirements [[srfi-1]] [[utf8]] [[miscmacros]] [[stack]] [[check-errors]] [[test]] [[test-utils]] == Author [[/users/kon-lovett|Kon Lovett]] == Repository This egg is hosted on the CHICKEN Subversion repository: [[https://anonymous@code.call-cc.org/svn/chicken-eggs/release/5/directory-utils|https://anonymous@code.call-cc.org/svn/chicken-eggs/release/5/directory-utils]] If you want to check out the source code repository of this egg and you are not familiar with Subversion, see [[/egg-svn-checkout|this page]]. == Version history ; 2.4.1 : Revert to "mkdir" as test find command. Drop test of deperecated. ; 2.4.0 : Add {{directory-foldl}}, {{directory-tree-unfold/*directory-tree-unfold}}, {{dot-prefix-dirname?}}, {{dot-suffix-dirname?}}. Deperecate {{directory-fold}} & {{which-command-pathnames}}. Dropped {{moremacros}} & {{list-utils}} dependencies. ; 2.3.0 : Add {{dirname?}}, use {{utf8}}, add {{directory-utils.types}} include, update test-runner. ; 2.2.5 : Update test-runner. ; 2.2.4 : Fix category. ; 2.2.3 : Update test-runner. ; 2.2.2 : Add strict-types, update test-gloss. ; 2.2.1 : Update test-gloss. ; 2.2.0 : Add optional {{stack}} argument to {{push-directory}}, {{pop-directory}}, {{pop-toplevel-directory}}. ; 2.1.0 : CHICKEN 5.1.0 dependent. ; 2.0.0 : CHICKEN 5 release. == License Copyright (C) 2010-2024 Kon Lovett. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you add 14 to 8?