1#| -*-Scheme-*-
2
3Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
4    1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
5    2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Massachusetts
6    Institute of Technology
7
8This file is part of MIT/GNU Scheme.
9
10MIT/GNU Scheme is free software; you can redistribute it and/or modify
11it under the terms of the GNU General Public License as published by
12the Free Software Foundation; either version 2 of the License, or (at
13your option) any later version.
14
15MIT/GNU Scheme is distributed in the hope that it will be useful, but
16WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with MIT/GNU Scheme; if not, write to the Free Software
22Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
23USA.
24
25|#
26
27;;;; Edwin Pathnames
28
29(declare (usual-integrations))
30
31(define (edwin-library-directory-pathname envvar required?)
32  (let ((envval (get-environment-variable envvar)))
33    (if envval
34	(pathname-as-directory (merge-pathnames envval))
35	(or (system-library-directory-pathname "edwin")
36	    (and required?
37		 (error "Can't find edwin library directory."))))))
38
39(define (edwin-binary-directory)
40  (edwin-library-directory-pathname "EDWIN_BINARY_DIRECTORY" #t))
41
42(define (edwin-info-directory)
43  (let ((pathname
44	 (edwin-library-directory-pathname "EDWIN_INFO_DIRECTORY" #f)))
45    (and pathname
46	 (merge-pathnames "info" (pathname-as-directory pathname)))))
47
48(define (edwin-etc-directory)
49  (edwin-library-directory-pathname "EDWIN_ETC_DIRECTORY" #t))
50
51(define (edwin-etc-pathname filename)
52  (let ((pathname (merge-pathnames filename (edwin-etc-directory))))
53    (if (not (file-exists? pathname))
54	(error "Unable to find file:" (->namestring pathname)))
55    pathname))
56
57(define (edwin-tutorial-pathname)
58  (edwin-etc-pathname "TUTORIAL"))
59
60(define default-homedir-pathname
61  ;; This binding exists to allow uses of the "home" directory as a
62  ;; default directory to be overridden.
63  user-homedir-pathname)