All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nativeMain.com.saveourtool.save.utils.ArchiveUtils.kt Maven / Gradle / Ivy

The newest version!
/**
 * Utils to unzip the archive
 */

package com.saveourtool.save.utils

import com.saveourtool.save.core.logging.logDebug
import okio.Path

actual fun Path.extractZipTo(targetPath: Path) {
    require(fs.metadata(targetPath).isDirectory)
    logDebug("Unzip ${fs.canonicalize(this)} into ${fs.canonicalize(targetPath)}")
    platform.posix.system("unzip $this -d $targetPath")
}

actual fun Path.extractZipHere() = parent?.let {
    extractZipTo(it)
} ?: throw IllegalStateException("Path to archive is set incorrectly.")




© 2015 - 2025 Weber Informatics LLC | Privacy Policy