Request: more file-system functions

Bug #231537 reported by Derick Eddington
2
Affects Status Importance Assigned to Milestone
Ikarus Scheme
Fix Committed
Wishlist
Derick Eddington

Bug Description

I'm starting to make a persistence framework and so I need the usual set of basic FS functions. I like Chez's from CSUG Section 9.11. File System Interface. Excerpted, excluding the one's Ikarus already has[*] and excluding Chez's pathname deconstructors:

[*] Ikarus's file-exists? currently doesn't accept the optional 2nd argument. I think it would be nice if it did.

procedure: (directory-list pathname)
returns: a list of file names

pathname must be a string. The return value is a list of strings representing the names of files found in the directory named by pathname.

procedure: (file-exists? pathname)
procedure: (file-exists? pathname follow?)
returns: #t if the file named by pathname exists, #f otherwise

pathname must be a string. If the optional follow? argument is true (the default), file-exists? follows symbolic links; otherwise it does not. Thus, file-exists? will return #f when handed the pathname of a broken symbolic link unless follow? is provided and is #f.

procedure: (file-regular? pathname)
procedure: (file-regular? pathname follow?)
returns: #t if the file named by pathame is a regular file, #f otherwise

pathname must be a string. If the optional follow? argument is true (the default), file-regular? follows symbolic links; otherwise it does not.

procedure: (file-directory? pathname)
procedure: (file-directory? pathname follow?)
returns: #t if the file named by pathame is a directory, #f otherwise

pathname must be a string. If the optional follow? argument is true (the default), file-directory? follows symbolic links; otherwise it does not.

procedure: (file-symbolic-link? pathname)
returns: #t if the file named by pathame is a symbolic link, #f otherwise

pathname must be a string. file-symbolic-link? never follows symbolic links in making its determination.

procedure: (mkdir pathname)
procedure: (mkdir pathname mode)
returns: unspecified

pathname must be a string, and mode must be a fixnum.

mkdir creates a directory with the name given by pathname. All pathname path components leading up to the last must already exist. If the optional mode argument is present, it overrides the default permissions for the new directory. Under Windows, the mode argument is ignored.

procedure: (delete-directory pathname)
procedure: (delete-directory pathname error?)
returns: see below

pathname must be a string. delete-directory removes the directory named by pathname. If the optional error? argument is false (the default), delete-directory returns a boolean value: #t if the operation is successuful and #f if it is not. Otherwise, delete-directory returns an unspecified value if the operation is successful and signals an error if it is not.

procedure: (chmod pathname mode)
returns: unspecified

pathname must be a string, and mode must be a fixnum.

chmod sets the permissions on the file named by pathname to mode. Under Windows, the chmod does nothing.

Changed in ikarus:
importance: Undecided → Wishlist
Revision history for this message
Derick Eddington (derick-eddington) wrote :

Oh yeah, I'll also need to be able to create symbolic links. make-link or mklink or whatever.

procedure: (make-link to path)
returns: unspecified

to and path must be strings. make-link creates a new symbolic link named path pointing to to. The creation will fail if path already exists. The to need not refer to an existing file or directory. If the link is not created successfully, a condition of type &i/o-filename is raised (or one of its sub-types if you think they correspond appropriately to the failure reasons).

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

Fixed in 1493. Thanks.

Changed in ikarus:
assignee: nobody → derick-eddington
status: New → Fix Committed
Changed in ikarus:
milestone: none → 0.0.4
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.