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