src/Pure/System/components.scala
author wenzelm
Mon, 03 Dec 2018 20:04:48 +0100
changeset 69395 d1c4a1dee9e7
child 69398 0698ded5caf1
permissions -rw-r--r--
more explicit support for Isabelle system components; activate_bundled_components: check component dir as in makedist_bundle;

/*  Title:      Pure/Admin/components.scala
    Author:     Makarius

Isabelle system components.
*/

package isabelle


object Components
{
  /* component collections */

  def admin(dir: Path): Path = dir + Path.explode("Admin/components")

  def contrib(dir: Path = Path.current, name: String = ""): Path =
    dir + Path.explode("contrib") + Path.explode(name)


  /* component directory content */

  def settings(dir: Path): Path = dir + Path.explode("etc/settings")
  def components(dir: Path): Path = dir + Path.explode("etc/components")

  def check_dir(dir: Path): Boolean =
    settings(dir).is_file || components(dir).is_file

  def read_components(dir: Path): List[String] =
    split_lines(File.read(components(dir))).filter(_.nonEmpty)

  def write_components(dir: Path, lines: List[String]): Unit =
    File.write(components(dir), terminate_lines(lines))
}