Change compile path

I’d like to change the compile path: in project.xml I can specify the path XXX in the tag “app”, but when targeting HTML5 I’d like to change the resulting path from


to simply


Is it possible to avoid the /html5/bin subpath?

The html5/ part is the way the tools separate the different targets,
and the bin/ part is there to separate the temporary files of the compilation and files like instanced template from the resulting application.

So I don’t think so.

What’s your need here?

Compiling more than one project I’d like to have the compiled folders (named like the corresponding application) in a single folder that can be simply copied from my HDD to the server without copying and renaming the single bin subfolders everytime I do a batch compile.


instead of

- app1/html5/bin/
- app2/html5/bin/

I think the thing to do is run a post-build script that copies the relevant directories into a different folder.

So you’ll have an “Export” folder where everything gets built, with lots of extraneous folders and files. Then you’ll have an “Upload” folder, which only has the files you intend to upload. (This makes it less likely that you’ll upload those extraneous files.)

It is an option (maybe THE option), I will have a look at it.

Yeah, I managed to compile and move/rename bin folder using the post-build script

c:\windows\system32\cmd.exe /c xcopy /y /s "$(OutputDir)\bin\flash\bin" "$(ProjectDir)\..\_compiled\$(ProjectName)\"

Now I’d like to parametrize the script to copy flash and html5 in different folders, something like

c:\windows\system32\cmd.exe /c xcopy /y /s "$(OutputDir)\bin\-TARGET-\bin" "$(ProjectDir)\..\_compiled\-TARGET-\$(ProjectName)\"

Is there a way to replace -TARGET- with the current compile target, “flash” or “html5”?
Also, is there a way to delete/empty the target folder before copying the new compiled one?
I tried to do a deltree before the copy operation, but it didn’t do anything.

Maybe I should try to move the script operations to a batch file, maybe it can execute more operations.

From this list, it looks like you could use either $(TargetPlatform) or $(TargetBuild).

Good! I will try it as soon as possible.
It looks like now I just need to find out how to empty the target folder.

rmdir <directory> /s
mkdir <directory>

This does not work

c:\windows\system32\cmd.exe rmdir "$(ProjectDir)\..\_compiled\$(TargetBuild)\$(ProjectName)\" /c xcopy /y /s "$(OutputDir)\bin\$(TargetBuild)\bin" "$(ProjectDir)\..\_compiled\$(TargetBuild)\$(ProjectName)\"

It compiles the new project in the existing folder, without deleting it first.

You don’t need to put it all on one line, nor do you need to type out the path to cmd.exe.

Try using this as your post-build script:

rmdir "$(ProjectDir)\..\_compiled\$(TargetBuild)\$(ProjectName)\" /s
mkdir "$(ProjectDir)\..\_compiled\$(TargetBuild)\$(ProjectName)\"
xcopy /y /s "$(OutputDir)\bin\$(TargetBuild)\bin" "$(ProjectDir)\..\_compiled\$(TargetBuild)\$(ProjectName)\"

Uhm… it causes an error:

cmd: rmdir "D:\xxx\..\_compiled\flash\Core\" /s
Exception: The system cannot find the specified file

but the folder is there!
Doing mkdir first I obtain the same error.

EDIT: I tried to specify the exact folder path without “…”, but nothing has changed.

Maybe the folder is open? No, it would give you a different message.

Try opening Command Prompt for yourself and running rmdir. Do you get the same error that way?
Can you cd into that directory? How about the directory above it? If you cd into the directory above it, can you remove it from there?

Yes, doing it directly from prompt it works.

Same error with

cd "$(ProjectDir)\..\_compiled\$(TargetBuild)\"

Perhaps it doesn’t like absolute paths? It runs the commands from your project directory, so maybe this will work:

rmdir ..\_compiled\$(TargetBuild)\$(ProjectName) /s
mkdir ..\_compiled\$(TargetBuild)\$(ProjectName)
xcopy /y /s "$(OutputDir)\bin\$(TargetBuild)\bin" ..\_compiled\$(TargetBuild)\$(ProjectName)

Failing that, it’s time to make a batch file and put all your commands in there. You’ll need to pass $(TargetBuild) and $(ProjectName) as parameters, but it should be more reliable overall.

Nothing, I will try the batch way.
I tried it yesterday, but I abandoned it because, if I am not wrong, it couldn’t execute the batch file, but I will retry.

I have tried with

"$(ProjectDir)"\postbuild.bat "$(OutputDir)" "$(TargetBuild)" "$(ProjectName)"

The .bat is

xcopy /c /y /s "%1\bin\%2\bin" "..\_compiled\%2\%3"

Running Post-Build Command Line…

cmd: "D:\xxx"\postbuild.bat "D:\xxx" "flash" "pjName"
Exception: Access denied

What’s happening?

Would "$(ProjectDir)\postbuild.bat" make a difference?

You could also try using an echo, to see if the error occurs before or after running your batch file

But how can I use $(OutputDir), $(TargetBuild) and $(ProjectName) without specifying tem?

EDIT: “$(ProjectDir)\postbuild.bat” “$(OutputDir)” “$(TargetBuild)” “$(ProjectName)” works, but only if target folder “flash” already exists!
So I edited the batch to do this

IF NOT EXIST "..\_compiled\%2\NUL" MD "..\_compiled\%2\%3"

xcopy /c /y /s "%1\bin\%2\bin" "..\_compiled\%2\%3"

If the folder %2/%3 already exists then it gives me the warning, but it continues compiling and copying.
I tried to delete the %3 before copying the compiled project, but no command works… :pensive: