Post Build Copy Files.

Hi. I have an executable file that needs to be copied to a resource folder after the build phase.
This seems easy enough to do using Insert, Build Step, Copy Files.

However what if I have an application that is for three platforms, Mac, Unix, Windows and that application is different for each?
Right now i’ve selected the resource folder as the destination, but should there be a resource folder for each platform?
How does this work?

By the way… Nothing happened when I built… No files were copied at all to the Resource Folder.

Each platform has a Resource folder. Windows and Linux are next to the app and on OS X, it’s in the Contents folder of the bundle.

Make sure the CopyFilesStep is inside the target you are building for, and is positioned below the Build step. As each target will need its own CopyFilesStep, you can put the platform specific version in each step.

ahhh! :slight_smile: The light goes on.

hmmm…
The script copyfiles can’t copy files to the destination in a pre build step. The destination does not exist yet. This step will not be executed.

I put it under build settings for the target OS X…

Drag it below the item named Build.

Drag it after the Build item, not before.

Got it thanks! :slight_smile: worx.

Tsk… wait a minute…
The resource needs to be OS Specific…
If it’s an executable file then there is a different one for each OS.
But there is no subdirectory under Resources
Am I making sense?

There’s a field for you to enter a custom folder, but I suspect that you’re missing the idea that each CopyFiles step should contain the binary for the proper build.

However, If it’s an executable file, it is better to simply place it into the same folder as your project’s executable or in a folder next to your app. I use a folder named “Tools”:

Windows:
My App\
My App\My App.exe
My App\Tools\My Helper.exe
My App\My App Libs\

OS X:
My App/
My App/MacOS
My App/MacOS/Contents
My App/MacOS/Contents/My App.app
My App/MacOS/Contents/Tools/My Helper
My App/MacOS/Resources
My App/MacOS/Framework

Linux:
My App\
My App\My App
My App\Tools\My Helper
My App\My App Libs\

I think after some experimentation I found that putting it in the same folder as the exectuable itself is a good indication that it’s for the right platform. (I put a copy file in each build in my project.)
cool… I think.

You’re on the correct path and this step definitely does need to be below the Build step in the list (they are in order). It definitely does require a separate CopyFilesStep for each platform.

I have a small issue.
I build in two places. Either on laptop or on my desktop.
The files i am copying are on my iCloud Drive.
However the copy fails from the laptop but succeeds from the desktop.
I had to open up my iCloud drive on the system that doesn’t work and re-drag-and-drop the file into the copy dialog.
I’m baffled as to why the paths would be different… They are relative to the build which is also in the iCloud drive.

[quote=207895:@Brian O’Brien]I have a small issue.
I build in two places. Either on laptop or on my desktop.
The files i am copying are on my iCloud Drive.
However the copy fails from the laptop but succeeds from the desktop.
I had to open up my iCloud drive on the system that doesn’t work and re-drag-and-drop the file into the copy dialog.
I’m baffled as to why the paths would be different… They are relative to the build which is also in the iCloud drive.[/quote]

Having the project or the build in a cloud drive is not very reliable. There has been a flurry of accounts of strange things happening with DropBox for instance. You would probably get safer results by building on your local disk and copy to the cloud drive after that. There has also been reports of projects not being updated when they were stored on DropBox, losing in the process some of the latest modifications.

What you report could be of the same nature.

It isn’t a question of reliability its a question of paths being different on different hosts.

It also has to do with their contents being locked at odd times and the fact that some remote drives don’t send or update their published permissions very often.