Skip to content

Commit

Permalink
fixup! Add file associations support
Browse files Browse the repository at this point in the history
[Desktop: Add support for file associations](#773)
  • Loading branch information
zhelenskiy committed Jul 1, 2024
1 parent a435833 commit df432b0
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ abstract class AbstractJPackageTask @Inject constructor(
internal val fileAssociations: SetProperty<FileAssociation> = objects.setProperty(FileAssociation::class.java)

private val iconMapping by lazy {
val icons = fileAssociations.orNull.orEmpty().mapNotNull { it.iconFile }.distinct()
val icons = fileAssociations.get().mapNotNull { it.iconFile }.distinct()
if (icons.isEmpty()) return@lazy emptyMap()
val iconTempNames: List<String> = mutableListOf<String>().apply {
val usedNames = mutableSetOf("${packageName.get()}.icns")
Expand Down Expand Up @@ -411,7 +411,7 @@ abstract class AbstractJPackageTask @Inject constructor(
val propertyFilesDirJava = propertyFilesDir.ioFile
fileOperations.clearDirs(propertyFilesDir)

val fileAssociationFiles = fileAssociations.orNull.orEmpty()
val fileAssociationFiles = fileAssociations.get()
.groupBy { it.extension }
.mapValues { (extension, associations) ->
associations.mapIndexed { index, association ->
Expand Down Expand Up @@ -696,8 +696,8 @@ abstract class AbstractJPackageTask @Inject constructor(
?: "Copyright (C) $year"
plist[PlistKeys.NSSupportsAutomaticGraphicsSwitching] = "true"
plist[PlistKeys.NSHighResolutionCapable] = "true"
val fileAssociationMutableSet = fileAssociations.orNull
if (!fileAssociationMutableSet.isNullOrEmpty()) {
val fileAssociationMutableSet = fileAssociations.get()
if (fileAssociationMutableSet.isNotEmpty()) {
plist[PlistKeys.CFBundleDocumentTypes] = fileAssociationMutableSet
.groupBy { it.mimeType to it.description }
.map { (key, extensions) ->
Expand Down

0 comments on commit df432b0

Please sign in to comment.