Question

I am building dmg file by using ant tool, but I am getting error while build.

Extract of build.xml:

            ...
            <copy todir="${mac.build.dir}/.background">
                    <fileset file="${basedir}/build/installer/images/mac/dmgBackground.png"/>
            </copy>

            <symlink link="${mac.build.dir}/Applications" overwrite="true" resource="/Applications" />
            <echo message="Create tmp.dmg"/>
            <exec executable="hdiutil" failonerror="true">
                    <arg line="create -srcfolder '${mac.build.dir}' -volname '${mac.volname}' -fs HFS+ -fsargs '-c c=64,a=16,e=16' -format UDRW '${target}/tmp.dmg'"/>
            </exec>
            ....

Error:

**BUILD FAILED
D:\DevProjects\spark\build\build.xml:761: Could not launch ln: java.io.IOException: Cannot run program "ln": CreateProcess error=2, The system cannot find the file specified**

I used script to invoke dmg file creation is ant installer.mac

Am I invoking correct target or wrong one?

Was it helpful?

Solution

Ant's symlink task doesn't work on Windows variants.

See SO: Ant symlink task on windows (NTFS)

From the Ant documentation:

Manages symbolic links on Unix based platforms. Can be used to make an individual link, delete a link, create multiple links from properties files, or create properties files describing links in the specified directories. Existing links are not overwritten by default.

... and ...

LIMITATIONS: Because Java has no direct support for handling symlinks this task divines them by comparing canonical and absolute paths. On non-unix systems this may cause false positives. Furthermore, any operating system on which the command ln -s is not a valid command on the command line will not be able to use action="single" or action="recreate". Action="record" and action=delete should still work. Finally, the lack of support for symlinks in Java means that all links are recorded as links to the canonical resource name. Therefore the link: link --> subdir/dir/../foo.bar will be recorded as link=subdir/foo.bar and restored as link --> subdir/foo.bar


As to how to fix it, I'm now out of my depth as I've never made a DMG before. However, the symlink is a link to the Applications folder, and may simply be there so that the user has a handy link to drag the application to in order to copy into Applications. As such, that link may not be strictly necessary. If anyone can shine some light on this, please do.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top