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

A solution to the case problem?



After hacking around for a little while this morning, I came up with the
following hack.  It seems to work for Lispm-to-Lispm renaming, whether
it be local or remote.  I'm not making any guarantees, but this should
help those who like to rename the case on their files.

To use it:  o Compile the functions into a file (e.g. >me>foo.bin"
        o Load the binary file on the remote and server machines
            o use :Rename File <old> <new>

Cheers,
Scott


;;; -*- Mode: LISP; Syntax: Common-lisp; Package: FS; Base: 10 -*-
1;; This hack allows one to rename a file and change its case.  It only
;; works for LMFS to LMFS renaming.

;; This file should be loaded on both the file server and the remote
;; machine.

0(defvar2 *ignore-cached-pathnames*0 nil
  "Set to T when you want to ignore the cached version of a pathname")

(defmethod2 (:get-pathname pathname-hash-table-mixin :before)
0       (dev dir nam type ver others key)
  (ignore dev dir nam type ver others)
  (when *ignore-cached-pathnames* (remhash key self)))

(advise server-parse-request :around 2rename-fix0 nil
  (without-interrupts
    (let ((*ignore-cached-pathnames*
        (and arglist
         (listp arglist)
         (listp (first arglist))
         (eq (caar arglist) :rename))))
    :do-it)))

(advise (cp::command-parser si:com-rename-file) :around 2rename-fix0 nil
  (let ((*ignore-cached-pathnames* t))
    (setq values :do-it)
    values))

(advise si::com-rename-file :around 2rename-fix0 nil
  (let ((*ignore-cached-pathnames* t))
    (setq values :do-it)
    values))

(compile-flavor-methods pathname-hash-table-mixin)