From 4a45d5faa074fd9914ad21b3e3ecdb03a0e8ced1 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 10 Jul 2013 12:29:37 -0600 Subject: [PATCH] look for default preferences file in the configuration directory ... instead of a "defaults" collection. --- .../scribblings/reference/filesystem.scrbl | 6 +++--- racket/lib/collects/defaults/README | 2 -- racket/lib/collects/racket/file.rkt | 13 ++++++++----- 3 files changed, 11 insertions(+), 10 deletions(-) delete mode 100644 racket/lib/collects/defaults/README diff --git a/pkgs/racket-pkgs/racket-doc/scribblings/reference/filesystem.scrbl b/pkgs/racket-pkgs/racket-doc/scribblings/reference/filesystem.scrbl index dee96faa68..e4502ab87e 100644 --- a/pkgs/racket-pkgs/racket-doc/scribblings/reference/filesystem.scrbl +++ b/pkgs/racket-pkgs/racket-doc/scribblings/reference/filesystem.scrbl @@ -1088,9 +1088,9 @@ Extracts a preference value from the file designated by is provided and is not @racket[#f]. In the former case, if the preference file doesn't exist, @racket[get-preferences] attempts to read an @elemref["old-prefs"]{old preferences file}, and then a -@filepath{racket-prefs.rktd} file in the @filepath{defaults} -collection, instead. If none of those files exists, the preference set -is empty. +@filepath{racket-prefs.rktd} file in the configuration directory +(as reported by @racket[find-config-dir]), instead. If none of those +files exists, the preference set is empty. The preference file should contain a list of symbol--value lists written with the default parameter settings. Keys diff --git a/racket/lib/collects/defaults/README b/racket/lib/collects/defaults/README deleted file mode 100644 index c4ba65ba5a..0000000000 --- a/racket/lib/collects/defaults/README +++ /dev/null @@ -1,2 +0,0 @@ -This directory hold defaults for the DrRacket preferences. -For more information, search the documentation for "site-specific". diff --git a/racket/lib/collects/racket/file.rkt b/racket/lib/collects/racket/file.rkt index f1196385ee..53b2eb3910 100644 --- a/racket/lib/collects/racket/file.rkt +++ b/racket/lib/collects/racket/file.rkt @@ -1,5 +1,6 @@ #lang racket/base (require "path.rkt" + setup/dirs (for-syntax racket/base setup/path-to-relative)) @@ -410,12 +411,14 @@ (expand-user-path "~/.plt-scheme/plt-prefs.ss")])]) (if (file-exists? alt-f) (values alt-f #f) - ;; Last chance: check for a "defaults" collection: - ;; (error here in case there's no "defaults" - ;; bails out through above `with-handlers') + ;; Last chance: check for a "racket-prefs.rtkd" file + ;; in the configuration directory: (values - (collection-file-path "racket-prefs.rktd" - "defaults") + (let ([f (build-path (find-config-dir) "racket-prefs.rktd")]) + (if (file-exists? f) + f + ;; Trigger a filesystem error: + (call-with-input-file* f void))) #f))))))]) (let ([prefs (with-pref-params (lambda ()