263 override def is_file(path: Path): Boolean = run_ssh(args = "test -f " + bash_path(path)).ok |
263 override def is_file(path: Path): Boolean = run_ssh(args = "test -f " + bash_path(path)).ok |
264 |
264 |
265 override def eq_file(path1: Path, path2: Path): Boolean = |
265 override def eq_file(path1: Path, path2: Path): Boolean = |
266 path1 == path2 || execute("test " + bash_path(path1) + " -ef " + bash_path(path2)).ok |
266 path1 == path2 || execute("test " + bash_path(path1) + " -ef " + bash_path(path2)).ok |
267 |
267 |
268 override def delete(path: Path): Unit = { |
268 override def delete(paths: Path*): Unit = |
269 val cmd = if (is_dir(path)) "rmdir" else if (is_file(path)) "rm" else "" |
269 if (paths.nonEmpty) { |
270 if (cmd.nonEmpty) run_sftp(cmd + " " + sftp_path(path)) |
270 val script = |
271 } |
271 "set -e\n" + |
|
272 "for X in " + paths.iterator.map(bash_path).mkString(" ") + "\n" + |
|
273 """do if test -d "$X"; then rmdir "$X"; else rm -f "$X"; fi; done""" |
|
274 execute(script).check |
|
275 } |
272 |
276 |
273 override def restrict(path: Path): Unit = |
277 override def restrict(path: Path): Unit = |
274 if (!execute("chmod g-rwx,o-rwx " + bash_path(path)).ok) { |
278 if (!execute("chmod g-rwx,o-rwx " + bash_path(path)).ok) { |
275 error("Failed to change permissions of " + quote(remote_path(path))) |
279 error("Failed to change permissions of " + quote(remote_path(path))) |
276 } |
280 } |
504 def absolute_path(path: Path): Path = path.absolute |
508 def absolute_path(path: Path): Path = path.absolute |
505 def bash_path(path: Path): String = File.bash_path(path) |
509 def bash_path(path: Path): String = File.bash_path(path) |
506 def is_dir(path: Path): Boolean = path.is_dir |
510 def is_dir(path: Path): Boolean = path.is_dir |
507 def is_file(path: Path): Boolean = path.is_file |
511 def is_file(path: Path): Boolean = path.is_file |
508 def eq_file(path1: Path, path2: Path): Boolean = File.eq(path1, path2) |
512 def eq_file(path1: Path, path2: Path): Boolean = File.eq(path1, path2) |
509 def delete(path: Path): Unit = path.file.delete |
513 def delete(paths: Path*): Unit = paths.foreach(path => path.file.delete) |
510 def restrict(path: Path): Unit = File.restrict(path) |
514 def restrict(path: Path): Unit = File.restrict(path) |
511 def set_executable(path: Path, reset: Boolean = false): Unit = |
515 def set_executable(path: Path, reset: Boolean = false): Unit = |
512 File.set_executable(path, reset = reset) |
516 File.set_executable(path, reset = reset) |
513 def make_directory(path: Path): Path = Isabelle_System.make_directory(path) |
517 def make_directory(path: Path): Path = Isabelle_System.make_directory(path) |
514 def rm_tree(dir: Path): Unit = Isabelle_System.rm_tree(dir) |
518 def rm_tree(dir: Path): Unit = Isabelle_System.rm_tree(dir) |