Module: environment-internal-commands Synopsis: The internal-only commands provided by the environment Author: Andy Armstrong 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 /// Debugging properties // Personal-root property define class () end class ; define command-property personal-root => (summary: "Personal root directory", documentation: "The root directory of the personal area.", type: ) end command-property personal-root; define method show-property (context :: , property :: ) => () message(context, "Personal root: %s", environment-variable("OPEN_DYLAN_USER_ROOT")) end method show-property; define method set-property (context :: , property :: , root :: , #key save?) => () maybe-set-roots(context, personal-root: root) end method set-property; // System-root property define class () end class ; define command-property system-root => (summary: "System root directory", documentation: "The root directory of the system area.", type: ) end command-property system-root; define method show-property (context :: , property :: ) => () message(context, "System root: %s", environment-variable("OPEN_DYLAN_RELEASE_ROOT")) end method show-property; define method set-property (context :: , property :: , root :: , #key save?) => () maybe-set-roots(context, system-root: root) end method set-property; // Registries property define class () end class ; define command-property registries => (summary: "Project manager registries", documentation: "The set of project manager registries.") end command-property registries; define method show-property (context :: , property :: ) => () let (processor, os) = default-platform-info(*default-project-class*); let registries = find-registries(processor, os); for (registry in registries) message(context, " %s", registry) end end method show-property; /// Utilities define constant $personal-directories = #(#("OPEN_DYLAN_USER_ROOT"), #("OPEN_DYLAN_USER_BUILD", "build"), #("OPEN_DYLAN_USER_INSTALL"), #("OPEN_DYLAN_USER_SOURCES", "sources"), #("OPEN_DYLAN_USER_REGISTRIES", "sources", "registry")); define constant $system-directories = #(#("OPEN_DYLAN_RELEASE_ROOT"), #("OPEN_DYLAN_RELEASE_BUILD", "build"), #("OPEN_DYLAN_RELEASE_INSTALL"), #("OPEN_DYLAN_RELEASE_SOURCES", "sources"), #("OPEN_DYLAN_RELEASE_REGISTRIES", "sources", "registry")); define method maybe-set-roots (context :: , #key personal-root :: false-or(), system-root :: false-or()) => () local method set-variable (variable :: , directory :: , subdirectories :: ) let subdirectory = apply(subdirectory-locator, directory, subdirectories); environment-variable(variable) := as(, subdirectory) end method set-variable; if (personal-root) for (directory-info :: in $personal-directories) let variable = directory-info.head; let subdirectories = directory-info.tail; set-variable(variable, personal-root, subdirectories) end end; if (system-root) for (directory-info :: in $system-directories) let variable = directory-info.head; let subdirectories = directory-info.tail; set-variable(variable, system-root, subdirectories) end end end method maybe-set-roots; /// Registry commands define command-group registry into environment (summary: "registry commands", documentation: "Registry commands.") property personal-root; property system-root; property registries; end command-group registry;