Skip to content

Commit

Permalink
Small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
soywiz committed Jun 20, 2024
1 parent 9aaf128 commit 28a962b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 27 deletions.
52 changes: 29 additions & 23 deletions src/main/kotlin/korge/TarTools.kt
Original file line number Diff line number Diff line change
Expand Up @@ -73,29 +73,35 @@ open class TarTools(
else -> {
outputFile.parentFile?.mkdirs()
val bytes = tarInput.readBytes()
outputFile.writeBytes(bytes)
//Files.copy(tarInput, outputFile.toPath(), StandardCopyOption.REPLACE_EXISTING)
Files.setLastModifiedTime(outputFile.toPath(), entry.lastModifiedTime)

if (OS.CURRENT != OS.WINDOWS) {
//val mode = "755".toInt(8)
val mode = entry.mode

// Convert mode to set of PosixFilePermission
val permissions = mutableSetOf<PosixFilePermission>()

if (mode and 0b100000000 != 0) permissions.add(PosixFilePermission.OWNER_READ)
if (mode and 0b010000000 != 0) permissions.add(PosixFilePermission.OWNER_WRITE)
if (mode and 0b001000000 != 0) permissions.add(PosixFilePermission.OWNER_EXECUTE)
if (mode and 0b000100000 != 0) permissions.add(PosixFilePermission.GROUP_READ)
if (mode and 0b000010000 != 0) permissions.add(PosixFilePermission.GROUP_WRITE)
if (mode and 0b000001000 != 0) permissions.add(PosixFilePermission.GROUP_EXECUTE)
if (mode and 0b000000100 != 0) permissions.add(PosixFilePermission.OTHERS_READ)
if (mode and 0b000000010 != 0) permissions.add(PosixFilePermission.OTHERS_WRITE)
if (mode and 0b000000001 != 0) permissions.add(PosixFilePermission.OTHERS_EXECUTE)

// Set the permissions
Files.setPosixFilePermissions(outputFile.toPath(), permissions)
try {
outputFile.parentFile.mkdirs()
if (outputFile.isDirectory) outputFile.deleteRecursively()
outputFile.writeBytes(bytes)
//Files.copy(tarInput, outputFile.toPath(), StandardCopyOption.REPLACE_EXISTING)
Files.setLastModifiedTime(outputFile.toPath(), entry.lastModifiedTime)

if (OS.CURRENT != OS.WINDOWS) {
//val mode = "755".toInt(8)
val mode = entry.mode

// Convert mode to set of PosixFilePermission
val permissions = mutableSetOf<PosixFilePermission>()

if (mode and 0b100000000 != 0) permissions.add(PosixFilePermission.OWNER_READ)
if (mode and 0b010000000 != 0) permissions.add(PosixFilePermission.OWNER_WRITE)
if (mode and 0b001000000 != 0) permissions.add(PosixFilePermission.OWNER_EXECUTE)
if (mode and 0b000100000 != 0) permissions.add(PosixFilePermission.GROUP_READ)
if (mode and 0b000010000 != 0) permissions.add(PosixFilePermission.GROUP_WRITE)
if (mode and 0b000001000 != 0) permissions.add(PosixFilePermission.GROUP_EXECUTE)
if (mode and 0b000000100 != 0) permissions.add(PosixFilePermission.OTHERS_READ)
if (mode and 0b000000010 != 0) permissions.add(PosixFilePermission.OTHERS_WRITE)
if (mode and 0b000000001 != 0) permissions.add(PosixFilePermission.OTHERS_EXECUTE)

// Set the permissions
Files.setPosixFilePermissions(outputFile.toPath(), permissions)
}
} catch (e: Throwable) {
e.printStackTrace()
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/main/resources/catalog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,15 @@ actions:
- download.macos: "https://github.com/korlibs/forge.korge.org/releases/download/2024.1.1-alpha/korgeforge-mac-product-info.241.15989.20240606.json::0bcd093ea0df95f49ead6c20cd8bfc28d17940590c2e4bf64ecb97e274b637c1"
copy: $out/Resources/product-info.json
forge_610:
- download: "https://github.com/korlibs/forge.korge.org/releases/download/2024.1.1-alpha/korge-forge-plugin-6.1.0.jar::311423a9eb01b9161f975f33012811aa355eac1c0f4ae705d61260a0d9bc4ca6"
#local_file: "korge-forge-plugin-6.1.0.jar"
- download: "https://github.com/korlibs/forge.korge.org/releases/download/2024.1.1-alpha/korge-forge-plugin-6.1.1.jar::064e254e0de638f759e42fe26fd0ee1fc7fe96aa0d44198224741abfc6140417"
copy: $out/plugins/KorgePlugin/lib/korge-forge-plugin.jar.jar
shortcuts:
- create_shortcuts: true
parallel_empty:
m2.korlibs:
- download: "https://github.com/korlibs/korlibs/releases/download/v6.0.0-alpha5/korlibs-6.0.0-alpha5.tar.zstd::f8383e3400e87231d2a4d263f6cd6c5add569165f39eb7a7f7d45658f43d3b3b"
#local_file: "artifacts-korlibs-6.0.0-alpha5.tar.zstd"
extract: $home/.m2/repositories
extract: $home/.m2/repository
m2.korge:
- download: "https://github.com/korlibs/korge/releases/download/v6.0.0-alpha5/korge-6.0.0-alpha5.tar.zstd::ffacbccbf25871083bb8d82d931db14521e5edf91e370d9ab542bf4d0e13f746"
extract: $home/.m2/repositories
extract: $home/.m2/repository

0 comments on commit 28a962b

Please sign in to comment.