69395
|
1 |
/* Title: Pure/Admin/components.scala
|
|
2 |
Author: Makarius
|
|
3 |
|
|
4 |
Isabelle system components.
|
|
5 |
*/
|
|
6 |
|
|
7 |
package isabelle
|
|
8 |
|
|
9 |
|
|
10 |
object Components
|
|
11 |
{
|
|
12 |
/* component collections */
|
|
13 |
|
|
14 |
def admin(dir: Path): Path = dir + Path.explode("Admin/components")
|
|
15 |
|
|
16 |
def contrib(dir: Path = Path.current, name: String = ""): Path =
|
|
17 |
dir + Path.explode("contrib") + Path.explode(name)
|
|
18 |
|
|
19 |
|
|
20 |
/* component directory content */
|
|
21 |
|
|
22 |
def settings(dir: Path): Path = dir + Path.explode("etc/settings")
|
|
23 |
def components(dir: Path): Path = dir + Path.explode("etc/components")
|
|
24 |
|
|
25 |
def check_dir(dir: Path): Boolean =
|
|
26 |
settings(dir).is_file || components(dir).is_file
|
|
27 |
|
|
28 |
def read_components(dir: Path): List[String] =
|
|
29 |
split_lines(File.read(components(dir))).filter(_.nonEmpty)
|
|
30 |
|
|
31 |
def write_components(dir: Path, lines: List[String]): Unit =
|
|
32 |
File.write(components(dir), terminate_lines(lines))
|
|
33 |
}
|