sftp.mkdirs according to 2a5dbad75355;
authorwenzelm
Sun, 16 Oct 2016 16:58:09 +0200
changeset 64254 b1aef25ce8df
parent 64253 a4718dfc9cd4
child 64255 a9f540881611
sftp.mkdirs according to 2a5dbad75355;
src/Pure/General/ssh.scala
--- a/src/Pure/General/ssh.scala	Sun Oct 16 16:57:48 2016 +0200
+++ b/src/Pure/General/ssh.scala	Sun Oct 16 16:58:09 2016 +0200
@@ -150,6 +150,13 @@
     def is_file(path: Path): Boolean = stat(path).map(_.is_file) getOrElse false
     def is_dir(path: Path): Boolean = stat(path).map(_.is_dir) getOrElse false
 
+    def mkdirs(path: Path): Unit =
+      if (!is_dir(path)) {
+        session.execute(
+          "perl -e \"use File::Path make_path; make_path('" + remote_path(path) + "');\"")
+        if (!is_dir(path)) error("Failed to create directory: " + quote(remote_path(path)))
+      }
+
     def read_dir(path: Path): List[Dir_Entry] =
     {
       val dir = channel.ls(remote_path(path))