federkasten / appbundle-maven-plugin

Maven plugin that creates an Application Bundle for OS X containing all your project dependencies and the necessary metadata
Apache License 2.0
179 stars 56 forks source link

passing arguments to the application #43

Open darthShana opened 6 years ago

darthShana commented 6 years ago

Hi I wanted to ask if there was a way to pass arguments to the application I have custom Info.plist where i have

<key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLName</key> <string>Lost Victories Launcher</string> <key>CFBundleURLSchemes</key> <array> <string>lostvic</string> </array> </dict> </array>

which successfully launches the installed application when a user clicks on <a href="lostvic://lostVictoriesLauncher/game=eyJpZCI6ImJhdHRsZV9.... but i need a way to pass thew clicked url as an argument to the application which can read game=

in applescript this can be done by this techinque

Is there a way to do this in your current project? If not would it be easy for me to do?

librucha commented 6 years ago

Hi. You can use your own template for dictionary file (template) and define it in plugin configuration.

Configuration:

<configuration>
...
<dictionaryFile>myInfo.plist.template</dictionaryFile>
...
</configuration>

Then create new file named myInfo.plist.template under src/main/resources:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>
    <key>CFBundleExecutable</key>
    <string>${cfBundleExecutable}</string>
    <key>CFBundleIconFile</key>
    <string>${iconFile}</string>
    <key>CFBundleIdentifier</key>
    <string>${mainClass}</string>
    <key>CFBundleDisplayName</key>
    <string>${bundleName}</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>${bundleName}</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>${version}</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>NSHumanReadableCopyright</key>
    <string></string>
    <key>NSHighResolutionCapable</key>
    <true/>
    <key>NSSupportsAutomaticGraphicsSwitching</key>
    <true/>
    <key>JVMRuntime</key>
    <string>${jrePath}</string>
    <key>JVMRuntimePath</key>
    <string>${jreFullPath}</string>
    <key>JVMMainClassName</key>
    <string>${mainClass}</string>
    <key>JVMClassPaths</key>
    ${classpath}
    <key>JVMVersion</key>
    <string>${jvmVersion}</string>
    <key>JVMOptions</key>
    ${jvmOptions}
    <key>JVMArguments</key>
    <array/>
    <key>LauncherWorkingDirectory</key>
    <string>${workingDirectory}</string>
    <key>CFBundleURLTypes</key>
    <array>
      <dict>
        <key>CFBundleURLName</key>
        <string>Lost Victories Launcher</string>
        <key>CFBundleURLSchemes</key>
        <array>
          <string>lostvic</string>
        </array>
      </dict>
     </array>
  </dict>
</plist>