75 } |
75 } |
76 unpack(target_dir getOrElse base_dir, archive, progress = progress) |
76 unpack(target_dir getOrElse base_dir, archive, progress = progress) |
77 } |
77 } |
78 } |
78 } |
79 |
79 |
|
80 private val platforms_family: Map[Platform.Family.Value, Set[String]] = |
|
81 Map( |
|
82 Platform.Family.linux_arm -> Set("arm64-linux", "arm64_32-linux"), |
|
83 Platform.Family.linux -> Set("x86_64-linux", "x86_64_32-linux"), |
|
84 Platform.Family.macos -> |
|
85 Set("arm64-darwin", "arm64_32-darwin", "x86_64-darwin", "x86_64_32-darwin"), |
|
86 Platform.Family.windows -> |
|
87 Set("x86_64-cygwin", "x86_64-windows", "x86_64_32-windows", "x86-windows")) |
|
88 |
|
89 private val platforms_all: Set[String] = |
|
90 Set("x86-linux", "x86-cygwin") ++ platforms_family.iterator.flatMap(_._2) |
|
91 |
80 def purge(dir: Path, platform: Platform.Family.Value): Unit = |
92 def purge(dir: Path, platform: Platform.Family.Value): Unit = |
81 { |
93 { |
82 val purge_default = Set("x86-linux", "x86-cygwin", "arm64-linux") |
94 val purge_set = platforms_all -- platforms_family(platform) |
83 val purge_linux = Set("x86_64-linux", "x86_64_32-linux") |
|
84 val purge_macos = Set("arm64-darwin", "x86_64-darwin", "x86_64_32-darwin") |
|
85 val purge_windows = Set("x86_64-cygwin", "x86_64-windows", "x86_64_32-windows", "x86-windows") |
|
86 |
|
87 val purge_set = |
|
88 platform match { |
|
89 case Platform.Family.linux => purge_default ++ purge_macos ++ purge_windows |
|
90 case Platform.Family.macos => purge_default ++ purge_linux ++ purge_windows |
|
91 case Platform.Family.windows => purge_default ++ purge_linux ++ purge_macos |
|
92 } |
|
93 |
95 |
94 File.find_files(dir.file, |
96 File.find_files(dir.file, |
95 (file: JFile) => file.isDirectory && purge_set(file.getName), |
97 (file: JFile) => file.isDirectory && purge_set(file.getName), |
96 include_dirs = true).foreach(Isabelle_System.rm_tree) |
98 include_dirs = true).foreach(Isabelle_System.rm_tree) |
97 } |
99 } |