Browse Source
Add file associations support to Compose Desktop <!-- Optional --> Fixes #773 ## Testing Tested on the [sample project](https://github.com/zhelenskiy/file-associations-demo). Behaviours per OSs: - MacOS Sonoma: associations work for distributables. - Windows 11: associations work after the installation of the MSI. - Kubuntu: associations do not work, but everything else works fine. However, IDEA also does not have associations there, so I assume this is fine. I didn't write any unit tests because I don’t know which of them you are expecting me to write. So, I'm looking forward to your feedback and suggestions. <!-- Optional --> This should be tested by QA ## Release Notes <!-- Optional, if omitted - won't be included in the changelog Sections: - Highlights - Known issues - Breaking changes - Features - Fixes Subsections: - Multiple Platforms - iOS - Desktop - Web - Resources - Gradle Plugin --> ### Highlight - Desktop - Introduction of the new DSL function in `nativeDistributions` block: ```kotlin fun fileAssociation(mimeType: String, extension: String, description: String): Unit ```pull/5076/head v1.7.0-alpha01
Evgeniy Zhelenskiy
5 months ago
committed by
GitHub
12 changed files with 337 additions and 61 deletions
@ -0,0 +1,11 @@ |
|||||||
|
package org.jetbrains.compose.desktop.application.dsl |
||||||
|
|
||||||
|
import java.io.File |
||||||
|
import java.io.Serializable |
||||||
|
|
||||||
|
internal data class FileAssociation( |
||||||
|
val mimeType: String, |
||||||
|
val extension: String, |
||||||
|
val description: String, |
||||||
|
val iconFile: File?, |
||||||
|
) : Serializable |
@ -1,48 +1,123 @@ |
|||||||
<?xml version="1.0" ?> |
<?xml version="1.0" ?> |
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
||||||
<plist version="1.0"> |
<plist version="1.0"> |
||||||
<dict> |
<dict> |
||||||
<key>LSMinimumSystemVersion</key> |
<key>LSMinimumSystemVersion</key> |
||||||
<string>12.0</string> |
<string>12.0</string> |
||||||
<key>CFBundleDevelopmentRegion</key> |
<key>CFBundleDevelopmentRegion</key> |
||||||
<string>English</string> |
<string>English</string> |
||||||
<key>CFBundleAllowMixedLocalizations</key> |
<key>CFBundleAllowMixedLocalizations</key> |
||||||
<string>true</string> |
<string>true</string> |
||||||
<key>CFBundleExecutable</key> |
<key>CFBundleExecutable</key> |
||||||
<string>TestPackage</string> |
<string>TestPackage</string> |
||||||
<key>CFBundleIconFile</key> |
<key>CFBundleIconFile</key> |
||||||
<string>TestPackage.icns</string> |
<string>TestPackage.icns</string> |
||||||
<key>CFBundleIdentifier</key> |
<key>CFBundleIdentifier</key> |
||||||
<string>MainKt</string> |
<string>MainKt</string> |
||||||
<key>CFBundleInfoDictionaryVersion</key> |
<key>CFBundleInfoDictionaryVersion</key> |
||||||
<string>6.0</string> |
<string>6.0</string> |
||||||
<key>CFBundleName</key> |
<key>CFBundleName</key> |
||||||
<string>TestPackage</string> |
<string>TestPackage</string> |
||||||
<key>CFBundlePackageType</key> |
<key>CFBundlePackageType</key> |
||||||
<string>APPL</string> |
<string>APPL</string> |
||||||
<key>CFBundleShortVersionString</key> |
<key>CFBundleShortVersionString</key> |
||||||
<string>1.0.0</string> |
<string>1.0.0</string> |
||||||
<key>LSApplicationCategoryType</key> |
<key>LSApplicationCategoryType</key> |
||||||
<string>Unknown</string> |
<string>Unknown</string> |
||||||
<key>CFBundleVersion</key> |
<key>CFBundleVersion</key> |
||||||
<string>1.0.0</string> |
<string>1.0.0</string> |
||||||
<key>NSHumanReadableCopyright</key> |
<key>NSHumanReadableCopyright</key> |
||||||
<string>Copyright (C) CURRENT_YEAR</string> |
<string>Copyright (C) CURRENT_YEAR</string> |
||||||
<key>NSSupportsAutomaticGraphicsSwitching</key> |
<key>NSSupportsAutomaticGraphicsSwitching</key> |
||||||
<string>true</string> |
<string>true</string> |
||||||
<key>NSHighResolutionCapable</key> |
<key>NSHighResolutionCapable</key> |
||||||
<string>true</string> |
<string>true</string> |
||||||
|
<key>CFBundleDocumentTypes</key> |
||||||
|
<array> |
||||||
|
<dict> |
||||||
|
<key>CFBundleTypeRole</key> |
||||||
|
<string>Editor</string> |
||||||
|
<key>CFBundleTypeExtensions</key> |
||||||
|
<array> |
||||||
|
<string>kot</string> |
||||||
|
</array> |
||||||
|
<key>CFBundleTypeIconFile</key> |
||||||
|
<string>Kotlin_icon_big.icns</string> |
||||||
|
<key>CFBundleTypeMIMETypes</key> |
||||||
|
<string>text/kotlin</string> |
||||||
|
<key>CFBundleTypeName</key> |
||||||
|
<string>Kotlin Source File0</string> |
||||||
|
<key>CFBundleTypeOSTypes</key> |
||||||
|
<array> |
||||||
|
<string>****</string> |
||||||
|
</array> |
||||||
|
</dict> |
||||||
|
<dict> |
||||||
|
<key>CFBundleTypeRole</key> |
||||||
|
<string>Editor</string> |
||||||
|
<key>CFBundleTypeExtensions</key> |
||||||
|
<array> |
||||||
|
<string>kot1</string> |
||||||
|
</array> |
||||||
|
<key>CFBundleTypeIconFile</key> |
||||||
|
<string>TestPackage.icns</string> |
||||||
|
<key>CFBundleTypeMIMETypes</key> |
||||||
|
<string>text/kotlin</string> |
||||||
|
<key>CFBundleTypeName</key> |
||||||
|
<string>Kotlin Source File1</string> |
||||||
|
<key>CFBundleTypeOSTypes</key> |
||||||
|
<array> |
||||||
|
<string>****</string> |
||||||
|
</array> |
||||||
|
</dict> |
||||||
|
<dict> |
||||||
|
<key>CFBundleTypeRole</key> |
||||||
|
<string>Editor</string> |
||||||
|
<key>CFBundleTypeExtensions</key> |
||||||
|
<array> |
||||||
|
<string>kott</string> |
||||||
|
</array> |
||||||
|
<key>CFBundleTypeIconFile</key> |
||||||
|
<string>Kotlin_icon_big (1).icns</string> |
||||||
|
<key>CFBundleTypeMIMETypes</key> |
||||||
|
<string>text/kotlin</string> |
||||||
|
<key>CFBundleTypeName</key> |
||||||
|
<string>Kotlin Source File2</string> |
||||||
|
<key>CFBundleTypeOSTypes</key> |
||||||
|
<array> |
||||||
|
<string>****</string> |
||||||
|
</array> |
||||||
|
</dict> |
||||||
|
<dict> |
||||||
|
<key>CFBundleTypeRole</key> |
||||||
|
<string>Editor</string> |
||||||
|
<key>CFBundleTypeExtensions</key> |
||||||
|
<array> |
||||||
|
<string>kott1</string> |
||||||
|
</array> |
||||||
|
<key>CFBundleTypeIconFile</key> |
||||||
|
<string>TestPackage.icns</string> |
||||||
|
<key>CFBundleTypeMIMETypes</key> |
||||||
|
<string>text/kotlin</string> |
||||||
|
<key>CFBundleTypeName</key> |
||||||
|
<string>Kotlin Source File3</string> |
||||||
|
<key>CFBundleTypeOSTypes</key> |
||||||
|
<array> |
||||||
|
<string>****</string> |
||||||
|
</array> |
||||||
|
</dict> |
||||||
|
</array> |
||||||
|
|
||||||
<key>CFBundleURLTypes</key> |
<key>CFBundleURLTypes</key> |
||||||
<array> |
<array> |
||||||
<dict> |
<dict> |
||||||
<key>CFBundleURLName</key> |
<key>CFBundleURLName</key> |
||||||
<string>Exameple URL</string> |
<string>Example URL</string> |
||||||
<key>CFBundleURLSchemes</key> |
<key>CFBundleURLSchemes</key> |
||||||
<array> |
<array> |
||||||
<string>exampleUrl</string> |
<string>exampleUrl</string> |
||||||
</array> |
</array> |
||||||
</dict> |
</dict> |
||||||
</array> |
</array> |
||||||
</dict> |
</dict> |
||||||
</plist> |
</plist> |
||||||
|
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 36 KiB |
Loading…
Reference in new issue