copying files on installation

Hi there - when my Mac app opens it copies a whole lot of files to the library>application support>my app folder.

The problem is that the very next procedure after this happens, it uses files that are in this new folder, and if they are not there yet and still being copied, it crashes.

Is there a way to copy files so that the code does not go forward until the files are copied?

Don’t unpack the files in a thread.

If your application open code is

[code]IF MY FILES EXIST
UNPACK MY FILES
END IF

USE THE FILES[/code]

Then you wont hit this scenario

However, I can say that opening an app by double clicking a file can cause the Document Open event to fire before the App Open event.
And I have one app where the Window Open event literally never ever fires, so I had to put checking code into the Activate event.

Not as good, but still works, you can also insert a one second delay after the OS action.

I have some code where I get the OS to delete a folder of files via a Shell command (rather than cycling through them) and even though they are gone, Xojo still thinks they’re there in the next line! I put in a delay of one second the, then voil (or really non-voil), the files are no longer there in Xojo!