src/Pure/System/isabelle_system.scala
changeset 75220 1cbdf9cfc94b
parent 75219 6d1b64d76b57
child 75229 075467e070ba
--- a/src/Pure/System/isabelle_system.scala	Sat Mar 05 10:57:58 2022 +0100
+++ b/src/Pure/System/isabelle_system.scala	Sat Mar 05 11:12:26 2022 +0100
@@ -437,6 +437,15 @@
     else error("Expected to find GNU tar executable")
   }
 
+  def make_patch(base_dir: Path, src: Path, dst: Path, target_dir: Path = Path.current): Path =
+  {
+    val target = target_dir + src.base.patch
+    Isabelle_System.bash(
+      "diff -ru " + File.bash_path(src) + " " + File.bash_path(dst) + " > " + File.bash_path(target),
+      cwd = base_dir.file).check_rc(_ <= 1)
+    (base_dir + target).expand
+  }
+
   def hostname(): String = bash("hostname -s").check.out
 
   def open(arg: String): Unit =