How to save exec file in ant copy task

I created the Java FX package for Mac OS X using Ant. This is creating a package with two files - 1. MyApplication.app 2. MyApplication.dmg

I want to copy both files to another folder, so I wrote a command in my build.xml as file -

<copy todir="my_new_folder">
   <fileset dir="old_folder\bundles"/>
</copy>

It successfully copies both files to "my_new_folder". But when you run .app from "my_new_folder", my application does not start, although it starts from "old_folder" correctly.

When comparing the copied application, I found that on exec (the Unix executable file) is located in the MacOS folder ("Show package contents / Contents / MacOS"), which is not saved, its appearance changes in the document file.

How to keep it look like a Unix Executable File , as I just execute a simple copy directory.

Thanks Neelam Sharma

+5
source share
1 answer

As stated in the ant copy task:

Unix Note. File permissions are not saved when copying files; instead, they get UMASK permissions by default. This is due to the lack of any means to request or set file permissions at the current Java runtime. If you need a copy function that preserves permission, use this instead:

<exec executable="cp" ... >

So, in your case, replace <copy>with:

<exec executable="cp">
    <arg line="-R old_folder/bundles my_new_folder"/>
</exec>

(note that you must use a slash even if this ant script is used under Windows).

+7
source

All Articles