hyln9 / ikarus

Optimizing incremental native-code compiler for R6RS scheme. This is a forked repository.
https://launchpad.net/ikarus
Other
5 stars 0 forks source link

Request: more file-system functions #224

Closed hyln9 closed 10 years ago

hyln9 commented 10 years ago

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.

Launchpad Details: #LP231537 Derick Eddington - 2008-05-18 02:01:57 -0400

hyln9 commented 10 years ago

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).

Launchpad Details: #LPC Derick Eddington - 2008-05-18 02:47:38 -0400

hyln9 commented 10 years ago

Fixed in 1493. Thanks.

Launchpad Details: #LPC Abdulaziz Ghuloum - 2008-05-31 13:57:26 -0400