Module: build-system Synopsis: A build-system for Dylan PC Applications in Dylan Author: Roman Budzianowski Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc. All rights reserved. License: Functional Objects Library Public License Version 1.0 Dual-license: GNU Lesser General Public License Warranty: Distributed WITHOUT WARRANTY OF ANY KIND // Read in Shell Environment Variables for Builds define method read-environment-variable (variable :: , #key required? = #f) => (value :: false-or()) let value = environment-variable(variable); if (value | ~required?) value else error("Required Environment Variable %s is not set", variable); end if; end method; define function system-install-path() => (path :: false-or()); let path = read-environment-variable("OPEN_DYLAN_RELEASE_INSTALL"); if (path) let directory = as(, path); ensure-directories-exist(directory); directory end end; define function system-registry-path() => (path :: false-or()); let path = read-environment-variable("OPEN_DYLAN_RELEASE_REGISTRIES"); path & map(method(p) as(, p) end, tokenize-environment-variable(path)) end; define function system-release-path() => (path :: false-or()) let path = read-environment-variable("OPEN_DYLAN_RELEASE"); if (path) as(, path) else application-filename-path() end if; end; define function system-build-path() => (path :: false-or()) let path = read-environment-variable("OPEN_DYLAN_RELEASE_BUILD"); path & as(, path) end; define function application-filename-path () => (path :: ) let exe = application-filename(); unless (exe) error("Cannot locate %s release directory", release-product-name()) end; let exe-directory = locator-directory(as(, exe)); locator-directory(exe-directory) end; define function user-registry-path () => (path :: false-or()); let path = read-environment-variable("OPEN_DYLAN_USER_REGISTRIES"); path & map(method (p :: ) as(, p) end, tokenize-environment-variable(path)) end; define function user-install-path () => (path :: ) read-environment-path("OPEN_DYLAN_USER_INSTALL"); end; define variable *user-projects-path* = #f; define function user-projects-path-setter (paths :: ) *user-projects-path* := map(method(p) as(, p) end, paths) end; define function user-projects-path () => (path :: false-or()); *user-projects-path* | begin let path = environment-variable("OPEN_DYLAN_USER_PROJECTS"); path & map(method(p) as(, p) end, tokenize-environment-variable(path)) end end; define function user-build-path() => (path :: ); read-environment-path("OPEN_DYLAN_USER_BUILD", default: "build"); end; define function read-environment-path (name :: , #key default :: false-or()) => (path :: ) let path = read-environment-variable(name); if (~path) let root-path = user-root-path(); if (default) path := subdirectory-locator(root-path, default); else path := root-path end; else path := as(, path) end; ensure-directories-exist(path); path; end; define function user-root-path() => (path :: ); let path = read-environment-variable("OPEN_DYLAN_USER_ROOT"); let default = subdirectory-locator( if ($os-name == #"win32") as(, read-environment-variable("APPDATA")) else home-directory() end, "Open-Dylan"); (path & as(, path)) | default; end;