Very slow copy process using editor script

I’m making a metroidvania toolkit where once your game is built using the toolkit, it exports all the game only files to an export folder. That folder can then be opened by defold as a separate project, then the developer can continue to edit in the new project, or just compile and release it.

It all works well, except the editor script that copies the folders and files to the export folder. It takes entirely too long. Apparently os.execute isn’t available in editor scripts so I’m using editor.get method to read and write the files.

Is there a faster method for this? I don’t want to have to use a solution that is outside defold to make this work. I’m trying hard to keep this all LUA/defold based.

FWIW: When just using the native OS copy & Paste it only takes less than 2 seconds to write the files. But using the editor script takes a few minutes.

Well I think I found the answer. This always happens after I ask on this forum…the answer just hits me. Well I hope it’s the answer

Use

editor.execute

to run an os level copy. Just need to make sure I run the proper command based on the OS being used.

If there is a better way, someone please let me know.

1 Like

Yes, precisely, editor.execute() is here for it :wink: Check out the execution modes section in the manual for more details:

1 Like