- ((probe-directory dir)
- (let ((cmd (format nil "rm -rf ~A" (namestring dir))))
- (unless quiet
- (format *trace-output* ";; ~A" cmd))
- (command-output cmd)))
- ((eq if-does-not-exist :error)
- (error "Directory ~A does not exist [delete-directory-and-files]." dir))))
+ ((probe-directory dir)
+ (let ((cmd (format nil "rm -rf ~A" (namestring dir))))
+ (unless quiet
+ (format *trace-output* ";; ~A" cmd))
+ (command-output cmd)))
+ ((eq if-does-not-exist :error)
+ (error "Directory ~A does not exist [delete-directory-and-files]." dir))))
+
+(defun file-size (file)
+ (when (probe-file file)
+ #+allegro (let ((stat (excl.osi:stat (namestring file))))
+ (excl.osi:stat-size stat))
+ #+sbcl (sb-posix:stat-size (sb-posix:stat file))
+ #-(or allegro sbcl)
+ (with-open-file (in file :direction :input)
+ (file-length in))))
+
+(defun getpid ()
+ "Return the PID of the lisp process."
+ #+allegro (excl::getpid)
+ #+(and lispworks win32) (win32:get-current-process-id)
+ #+(and lispworks (not win32)) (system::getpid)
+ #+sbcl (sb-posix:getpid)
+ #+cmu (unix:unix-getpid)
+ #+openmcl (ccl::getpid)
+ #+(and clisp unix) (system::process-id)
+ #+(and clisp win32) (cond ((find-package :win32)
+ (funcall (find-symbol "GetCurrentProcessId"
+ :win32)))
+ (t
+ (system::getenv "PID")))
+ )
+
+