无法为Mac OS X构建应用程序,收到错误

时间:2012-08-23 05:50:47

标签: macos ant applescript dmg

我使用ant脚本构建.dmg文件,因此使用applescript将在下面进行操作。

以下是我得到的错误。

installer.mac:
    [mkdir] Created dir: /Users/damuammu/Desktop/spark-Mac/target/installer
    [mkdir] Created dir:
/Users/damuammu/Desktop/spark-Mac/target/MixTalx_app/.background
     [copy] Copying 1 file to
/Users/damuammu/Desktop/spark-Mac/target/MixTalx_app/.background
  [symlink] ln -s /Applications
/Users/damuammu/Desktop/spark-Mac/target/MixTalx_app/Applications
     [echo] Create tmp.dmg
     [exec] created: /Users/damuammu/Desktop/spark-Mac/target/tmp.dmg
     [echo] Attach tmp.dmg
     [exec] /dev/disk2                  Apple_partition_scheme
     [exec] /dev/disk2s1                Apple_partition_map
     [exec] /dev/disk2s2                Apple_HFS
        /Users/damuammu/Desktop/spark-Mac/target/tmp
     [exec] cp:
/Users/damuammu/Desktop/spark-Mac/build/installer/mac/RightDSStore: No
such file or directory
     [exec] Result: 1
     [exec] mac/dmg_spark.scpt: execution error: Finder got an error:
Can’t set item "Spark.app" of disk "MixTalx_2.6.3" to {140, 250}.
(-10006)

BUILD FAILED
/Users/damuammu/Desktop/spark-Mac/build/build.xml:775: exec returned: 1

以下是applescript

on run {volumeName, artPath, theHeight, theWidth, x1, y1, x2, y2, iconSize}
    tell application "Finder"
        tell disk (volumeName as string)
            open

            delay 2

            set dsStore to "\"" & "/Volumes/" & volumeName & "/" & ".DS_STORE\""

            tell container window
                set current view to icon view
                set toolbar visible to false
                set statusbar visible to false
                set the bounds to {10, 10, 658, 482}
                set statusbar visible to false
            end tell

            set opts to the icon view options of container window
            set the arrangement of opts to not arranged
            set the icon size of opts to 128
            --iconSize
            set background picture of opts to file ".background:dmgBackground.png"

            -- Icon positions
            delay 2
            set position of item "Spark.app" to {140, 250}
            set position of item "Applications" to {395, 250}
            delay 2

            update without registering applications
        end tell


        delay 10
    end tell
end run

任何人都可以就此问题提出建议。

1 个答案:

答案 0 :(得分:1)

在AppleScript运行之前,您的ant脚本中会出现错误。错误在这里:

     [exec] cp:
/Users/damuammu/Desktop/spark-Mac/build/installer/mac/RightDSStore: No
such file or directory

AppleScript的功能是让您安装的DMG音量看起来很漂亮。由于并非所有内容都在DMG中正确放置,因此Applescript后来失败了:

     [exec] mac/dmg_spark.scpt: execution error: Finder got an error:
Can’t set item "Spark.app" of disk "MixTalx_2.6.3" to {140, 250}.
(-10006)

但是,您需要做的是修复ant脚本失败并出现第一个错误。