[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: feature or lack thereof

> I have the impression that kcl is supposed to understand "~/" in filenames
> (under UNIX). This seems not to be the case in my implementation:

Nor in mine.  Here's my fix.

;;; -*- Mode: LISP; Base: 10.; Syntax: Common-lisp -*- 
;;;  Programmer: Scott Turner
;;;  Created:  8-Jun-90 by srt
;;;  Description: Compatibility routines for AKCL.  Mostly
;;;    convience functions.
;;;  End-of-Edit-History

;;;  Loading Functions
;;;  AKCL's load function on Unix doesn't understand the tilde 
;;;  syntax for HOME.  To remedy this, build our own load function
;;;  that performs magic on the path before handing it off to the
;;;  system load function.
;;;  Our solution is pretty hacky:  if the first character of the
;;;  filename string is a tilde, then strip it off and concatenate
;;;  on the home path.
(setf (symbol-function 'system-load-func) #'load)

(defun load (fname &key (verbose *load-verbose*)
		        (print nil)
			(if-does-not-exist :error))
  (if (and (stringp fname)
	   (eq (schar fname 0) #\~))
      (setq fname (concatenate 'string
		      (si:getenv "HOME")
		      (string-left-trim '(#\~) fname))))
  (system-load-func fname :verbose verbose
		          :print print
			  :if-does-not-exist if-does-not-exist))