--- a/NEWS Mon Jul 10 22:44:28 2023 +0200
+++ b/NEWS Tue Jul 11 11:37:23 2023 +0200
@@ -456,6 +456,9 @@
via Compress.Options and Compress.Cache. Bytes.uncompress automatically
detects the compression scheme.
+* File.set_executable in Isabelle/Scala has changed its mandatory "flag"
+to optional "reset", which opposite polarity. INCOMPATIBILITY.
+
New in Isabelle2022 (October 2022)
--- a/src/Pure/Admin/component_zstd.scala Mon Jul 10 22:44:28 2023 +0200
+++ b/src/Pure/Admin/component_zstd.scala Tue Jul 11 11:37:23 2023 +0200
@@ -15,7 +15,7 @@
val source = jar_dir + Path.explode(template.replace("{V}", version))
val target = Isabelle_System.make_directory(component_dir + Path.basic(name))
Isabelle_System.copy_file(source, target)
- if (exe) File.set_executable(target + source.base, true)
+ if (exe) File.set_executable(target + source.base)
}
}
--- a/src/Pure/General/file.scala Mon Jul 10 22:44:28 2023 +0200
+++ b/src/Pure/General/file.scala Tue Jul 11 11:37:23 2023 +0200
@@ -388,10 +388,9 @@
else path.file.canExecute
}
- def set_executable(path: Path, flag: Boolean = false): Unit = {
- if (Platform.is_windows && flag) Isabelle_System.chmod("a+x", path)
- else if (Platform.is_windows) Isabelle_System.chmod("a-x", path)
- else path.file.setExecutable(flag, false)
+ def set_executable(path: Path, reset: Boolean = false): Unit = {
+ if (Platform.is_windows) Isabelle_System.chmod(if (reset) "a-x" else "a+x", path)
+ else path.file.setExecutable(!reset, false)
}
--- a/src/Pure/General/ssh.scala Mon Jul 10 22:44:28 2023 +0200
+++ b/src/Pure/General/ssh.scala Tue Jul 11 11:37:23 2023 +0200
@@ -246,8 +246,8 @@
error("Failed to change permissions of " + quote(remote_path(path)))
}
- override def set_executable(path: Path, flag: Boolean = false): Unit =
- if (!execute("chmod a" + (if (flag) "+" else "-") + "x " + bash_path(path)).ok) {
+ override def set_executable(path: Path, reset: Boolean = false): Unit =
+ if (!execute("chmod a" + (if (reset) "-" else "+") + "x " + bash_path(path)).ok) {
error("Failed to change executable status of " + quote(remote_path(path)))
}
@@ -408,8 +408,8 @@
def is_file(path: Path): Boolean = path.is_file
def delete(path: Path): Unit = path.file.delete
def restrict(path: Path): Unit = File.restrict(path)
- def set_executable(path: Path, flag: Boolean = false): Unit =
- File.set_executable(path, flag = flag)
+ def set_executable(path: Path, reset: Boolean = false): Unit =
+ File.set_executable(path, reset = reset)
def make_directory(path: Path): Path = Isabelle_System.make_directory(path)
def rm_tree(dir: Path): Unit = Isabelle_System.rm_tree(dir)
def with_tmp_dir[A](body: Path => A): A = Isabelle_System.with_tmp_dir("tmp")(body)
--- a/src/Pure/Thy/export.scala Mon Jul 10 22:44:28 2023 +0200
+++ b/src/Pure/Thy/export.scala Tue Jul 11 11:37:23 2023 +0200
@@ -548,7 +548,7 @@
Isabelle_System.make_directory(path.dir)
val bytes = entry.bytes
if (!path.is_file || Bytes.read(path) != bytes) Bytes.write(path, bytes)
- File.set_executable(path, flag = entry.executable)
+ File.set_executable(path, reset = !entry.executable)
}
}
}