mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-26 12:05:36 +01:00
97ccb4840a
Agent application (macOS 10.11+). More info at https://www.insanelymac.com/forum/topic/341047-cloverapp-testing/
33 lines
733 B
Swift
33 lines
733 B
Swift
//
|
|
// Unzip.swift
|
|
// Clover
|
|
//
|
|
// Created by vector sigma on 31/10/2019.
|
|
// Copyright © 2019 CloverHackyColor. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
func unzip(file: String,
|
|
destination: String,
|
|
success: @escaping (Bool) -> Void) {
|
|
let task : Process = Process()
|
|
if #available(OSX 10.13, *) {
|
|
task.executableURL = URL(fileURLWithPath: "/usr/bin/unzip")
|
|
} else {
|
|
task.launchPath = "/usr/bin/unzip"
|
|
}
|
|
// unzip -d output_dir/ zipfiles.zip
|
|
task.arguments = ["-d", "\(destination)/", file]
|
|
|
|
let pipe: Pipe = Pipe()
|
|
task.standardOutput = pipe
|
|
task.standardError = pipe
|
|
|
|
task.terminationHandler = { task in
|
|
success((task.terminationStatus == 0))
|
|
}
|
|
|
|
task.launch()
|
|
}
|