Next: iklib io codecs, Up: iklib io [Index]
All the file–related functions defined by R6RS accept a Scheme string as representing a file pathname; internally such string is converted to a bytevector to be handed to the underlying operating system.
The following bindings are exported by the library (vicare)
.
In Vicare the string–to–filename conversion is performed by
the function returned by string->filename-func
, which defaults to
string->utf8
.
In Vicare the filename–to–string conversion is performed by
the function returned by filename->string-func
, which defaults to
utf8->string
.
Return #t
if ptn is a string or bytevector representing the
pathname of an existent directory; otherwise return #f
.
The following bindings are exported by the library (vicare
language-extensions posix)
.
Return #t
if obj is a string or bytevector, not empty, not
including a character whose ASCII representation is the null byte.
The argument pathname must be a string or bytevector. Return
#t
if pathname starts with a /
character, which means
it is valid as Unix–style absolute pathname; otherwise return #f
.
This function only acts upon its argument, never accessing the file system.
The argument pathname must be a string or bytevector. Return
#t
if pathname doest not start with a /
character, which means it is valid as Unix–style relative pathname;
otherwise return #f
.
This function only acts upon its argument, never accessing the file system.
Given a string representing a pathname: split it into the directory part and the tail part. Return 2 values: a string representing the directory part and a string representing the tail name part. If pathname is just the name of a file or directory relative to the current directory: the directory part is empty and the first returned value is the empty string.
Assume the pathname components separator is /
, which is
Unix–specific.
(receive (root tail) (split-pathname-root-and-tail "a/b") (list root tail)) ⇒ ("a" "b") (receive (root tail) (split-pathname-root-and-tail "ciao") (list root tail)) ⇒ ("" "ciao")
Return #t
if obj is a string or bytevector, possibly empty,
not including a character whose ASCII representation is the null
byte.
Split a file search path into its components and return a list of pathnames. A search path is meant to be a list of directory pathnames separated by a colon character; bytevector-path must be a bytevector, string-path must be a Scheme string, path must be a Scheme string or bytevector. Empty pathnames are discarded.
#!vicare (import (vicare)) (split-search-path-bytevector '#vu8()) ⇒ () (split-search-path-bytevector #ve(ascii "ciao:hello")) ⇒ (#ve(ascii "ciao") #ve(ascii "hello")) (split-search-path-bytevector '#ve(ascii "::::")) ⇒ () (split-search-path-string "") ⇒ () (split-search-path-string "ciao:hello:salut") ⇒ ("ciao" "hello" "salut") (split-search-path-string "::::") ⇒ () (split-search-path "ciao:hello:salut") ⇒ ("ciao" "hello" "salut") (split-search-path '#ve(ascii "ciao:hello:salut")) ⇒ (#ve(ascii "ciao") #ve(ascii "hello") #ve(ascii "salut"))
Return #t
if obj is a proper list of pathnames according to
file-pathname?
, file-string-pathname?
,
file-bytevector-pathname?
.
Split a file pathname into its components and return two values: a boolean, true if the pathname starts with a slash characters; the list of components which can be empty.
A pathname is meant to be a file or directory name with components separated by a slash character; bytevector-pathname must be a bytevector, string-pathname must be a Scheme string, path must be a Scheme string or bytevector.
Empty components are discarded.
#!vicare (import (vicare)) (split-pathname-bytevector '#vu8()) error→ "invalid pathname" (split-pathname-bytevector '#ve(ascii "ciao/hello")) ⇒ #f (#ve(ascii "ciao") #ve(ascii "hello")) (split-pathname-bytevector '#ve(ascii "////")) ⇒ #t () (split-pathname-string "") error→ "invalid pathname" (split-pathname-string "ciao/hello/salut") ⇒ #f ("ciao" "hello" "salut") (split-pathname-string "////") ⇒ #t () (split-pathname "ciao/hello/salut") ⇒ #f ("ciao" "hello" "salut") (split-pathname '#ve(ascii "/ciao/hello/salut")) ⇒ #t (#ve(ascii "ciao") #ve(ascii "hello") #ve(ascii "salut"))
Search a file pathname (regular file or directory) in the given search path.
pathname must be a string representing a file pathname; environment-variable must be a string representing a system environment variable.
#f
.
#f
.
#f
.
Notice that the file is searched in the process’ current working directory only if such directory is listed in the given path.
Search a file pathname (regular file or directory) in the given search path.
pathname must be a string representing a file pathname; list-of-directories must be a list of strings representing directory pathnames.
#f
.
#f
.
#f
.
Notice that the file is searched in the process’ current working directory only if such directory is listed in the given path.
Next: iklib io codecs, Up: iklib io [Index]