src/Pure/General/rsync.scala
changeset 77788 c2ce9ac85859
parent 77787 b20ac2c26ea3
child 77790 ed68c546746c
--- a/src/Pure/General/rsync.scala	Sat Apr 08 17:20:15 2023 +0200
+++ b/src/Pure/General/rsync.scala	Sat Apr 08 18:08:20 2023 +0200
@@ -14,22 +14,29 @@
       ssh: SSH.System = SSH.Local,
       archive: Boolean = true,
       protect_args: Boolean = true  // requires rsync 3.0.0, or later
-    ): Context = new Context(progress, ssh, archive, protect_args)
+    ): Context = {
+      val directory = Components.provide(Component_Rsync.home, ssh = ssh, progress = progress)
+      val remote_program = Component_Rsync.remote_program(directory)
+      val rsync_path = quote(File.standard_path(remote_program))
+      new Context(progress, ssh, rsync_path, archive, protect_args)
+    }
   }
 
   final class Context private(
     val progress: Progress,
     val ssh: SSH.System,
+    rsync_path: String,
     archive: Boolean,
-    protect_args: Boolean
+    protect_args: Boolean,
   ) {
-    def no_progress: Context = new Context(new Progress, ssh, archive, protect_args)
-    def no_archive: Context = new Context(progress, ssh, false, protect_args)
+    def no_progress: Context = new Context(new Progress, ssh, rsync_path, archive, protect_args)
+    def no_archive: Context = new Context(progress, ssh, rsync_path, false, protect_args)
 
     def command: String = {
       val ssh_command = ssh.client_command
-      "rsync" +
+      File.bash_path(Component_Rsync.local_program) +
         if_proper(ssh_command, " --rsh=" + Bash.string(ssh_command)) +
+        " --rsync-path=" + Bash.string(rsync_path) +
         (if (archive) " --archive" else "") +
         (if (protect_args) " --protect-args" else "")
     }