src/Pure/PIDE/resources.scala
changeset 64657 6209e0f7a4e8
parent 64656 65c8a7780538
child 64673 b5965890e54d
--- a/src/Pure/PIDE/resources.scala	Thu Dec 22 11:20:59 2016 +0100
+++ b/src/Pure/PIDE/resources.scala	Thu Dec 22 11:38:16 2016 +0100
@@ -53,6 +53,30 @@
 
 
 
+  /* source files of Isabelle/ML bootstrap */
+
+  def source_file(raw_name: String): Option[String] =
+  {
+    if (Path.is_wellformed(raw_name)) {
+      if (Path.is_valid(raw_name)) {
+        def check(p: Path): Option[Path] = if (p.is_file) Some(p) else None
+
+        val path = Path.explode(raw_name)
+        val path1 =
+          if (path.is_absolute || path.is_current) check(path)
+          else {
+            check(Path.explode("~~/src/Pure") + path) orElse
+              (if (Isabelle_System.getenv("ML_SOURCES") == "") None
+               else check(Path.explode("$ML_SOURCES") + path))
+          }
+        Some(File.platform_path(path1 getOrElse path))
+      }
+      else None
+    }
+    else Some(raw_name)
+  }
+
+
   /* theory files */
 
   def loaded_files(syntax: Outer_Syntax, text: String): List[String] =