old-preferences is gone (it was only there to convert old style preferences, and has been out for a long enough time)

svn: r14726

original commit: 8ee902de48dd3f93a02f795765020187af0813bd
This commit is contained in:
Eli Barzilay 2009-05-06 03:42:49 +00:00
parent 36add1d173
commit f5f5cf90aa

View File

@ -41,16 +41,6 @@ the state transitions / contracts are:
(define preferences:low-level-put-preferences (make-parameter put-preferences)) (define preferences:low-level-put-preferences (make-parameter put-preferences))
(define preferences:low-level-get-preference (make-parameter get-preference)) (define preferences:low-level-get-preference (make-parameter get-preference))
(define old-preferences-symbol 'plt:framework-prefs)
;; reading is delayed, in case the low-level parameter is changed
(define old-preferences #f)
(define (init-old-preferences)
(unless old-preferences
(set! old-preferences (make-hasheq))
(for ([line (in-list ((preferences:low-level-get-preference)
old-preferences-symbol (λ () '())))])
(hash-set! old-preferences (car line) (cadr line)))))
(define (add-pref-prefix p) (string->symbol (format "plt:framework-pref:~a" p))) (define (add-pref-prefix p) (string->symbol (format "plt:framework-pref:~a" p)))
;; preferences : hash-table[sym -o> any] ;; preferences : hash-table[sym -o> any]
@ -102,20 +92,6 @@ the state transitions / contracts are:
(add-pref-prefix p) (λ () (k (void))))]) (add-pref-prefix p) (λ () (k (void))))])
(hash-set! preferences p (unmarshall-pref p marshalled))))) (hash-set! preferences p (unmarshall-pref p marshalled)))))
;; initialize old-preferences if needed
(init-old-preferences)
;; if there is no value in the preferences table, but there is one
;; in the old version preferences file, take that:
(unless (hash-has-key? preferences p)
(when (hash-has-key? old-preferences p)
(hash-set! preferences p
(unmarshall-pref p (hash-ref old-preferences p)))))
;; clear the pref from the old table (just in case it was taking space -- we don't need it anymore)
(when (hash-has-key? old-preferences p)
(hash-remove! old-preferences p))
;; if it still isn't set, take the default value ;; if it still isn't set, take the default value
(unless (hash-has-key? preferences p) (unless (hash-has-key? preferences p)
(hash-set! preferences p (default-value (hash-ref defaults p)))) (hash-set! preferences p (default-value (hash-ref defaults p))))