Fixed bug in which removing a devel link could cause an error if the cache.ss file for the given version number didn't exist (e.g. because a devel link was installed, then mzscheme was upgraded, and then the devel link was removed)

svn: r3751
This commit is contained in:
Jacob Matthews 2006-07-18 15:47:27 +00:00
parent 0ead709016
commit 03a6ad2fde

View File

@ -69,14 +69,15 @@
;; remove-infodomain-entries : path -> void ;; remove-infodomain-entries : path -> void
(define (remove-infodomain-entries path) (define (remove-infodomain-entries path)
(let* ([pathbytes (path->bytes path)] (let* ([pathbytes (path->bytes path)]
[cache-file (build-path (PLANET-DIR) "cache.ss")] [cache-file (build-path (PLANET-DIR) "cache.ss")])
[cache-lines (with-input-from-file cache-file read)]) (when (file-exists? cache-file)
(with-output-to-file cache-file (let ([cache-lines (with-input-from-file cache-file read)])
(lambda () (with-output-to-file cache-file
(if (pair? cache-lines) (lambda ()
(write (filter (lambda (line) (not (and (pair? line) (equal? (car line) pathbytes)))) cache-lines)) (if (pair? cache-lines)
(printf "\n"))) (write (filter (lambda (line) (not (and (pair? line) (equal? (car line) pathbytes)))) cache-lines))
'truncate/replace))) (printf "\n")))
'truncate/replace)))))
;; listof X * listof X -> nonempty listof X ;; listof X * listof X -> nonempty listof X
;; returns de-prefixed version of l2 if l1 is a proper prefix of l2; ;; returns de-prefixed version of l2 if l1 is a proper prefix of l2;