Including and/or Excluding Build Assets

I tried to search the forums for the answer but I haven’t seen an answer to this question. I know Corona is all about cross platform but there are still some rough edges we need to deal with when it comes to build and deploy. The most obvious one is audio file support.

I found the androidizing article great because it shows how to use the device helper code to pick either an m4a or ogg file depending on the device. However, why should I have to include both when either build (iPhone or Android) will only use one? I want an easy way to tell the build what to include to support various use cases such as this. I could also make an argument for using this type of feature to include certain files based on the app store I’m targeting, etc.

This is similar to other technologies that have “build profiles” that can be configured. It would be better yet to also be able to reference build profile variables in code so I could have one common code base that builds “lean” and is easy to manage. However, my main goal right now is just to be able to help streamline my process and keep the builds lean. I’m already unhappy that I have to spawn duplicate content just to deal with this audio format issue, but it would be worse yet to have to have bloated builds also (this app has a lot of audio).

Is there any such feature in Corona? If not, is there an easy way to accomplish this without spawning a new project or something silly like that?

p.s., a killer feature request would be to just let me give Corona the raw 16 bit WAV and then control the audio format via build settings. If I tell Corona to compress my audio, it would compress as best for each platform and I have no audio “busy work” to do. :slight_smile:

I raised this point about a year ago, and it didn’t really get anywhere.

As far as I know, there is no way to get Corona to only include certain files, it’s all or nothing. The way I handled it was to put all of my oggs into a folder called “Android”, and my cafs into a folder called “iOS”. Then in my main.lua I do the following:

soundFolder = "" audioType = "" if system.getInfo('platformName') == "iPhone OS" then soundFolder = "iOS" audioType = ".caf" elseif system.getInfo('platformName') == "Mac OS X" then soundFolder = "iOS" audioType = ".caf" else soundFolder = "Android" audioType = ".ogg" end

Then the code for loading my sounds is:

local clickSound = audio.loadSound(soundFolder.."/click"..audioType)

When I want to build, I just drag the sound folder that I DON’T need out of the project.

I would much prefer being able to specify files or folders from the build menu, but in the meantime this worked for me.

+1 probably worth a post on feedback.coronalabs.com, unless somebody has already made a request.

Considering Corona’s strengths as a multi-format platform, this type of setup would certainly help.

For the record, the following blog post describes a suggestion on how to handle the audio file format issue:  http://www.coronalabs.com/blog/2013/03/26/androidizing-your-mobile-app/

I was considering using that technique in combination with a folder (similar to what Alan suggested).  At that point, you can just place a period (aka, dot) in front of the folder you want ignored when doing each build, and the build will ignore the contents and treat them as hidden.  I already use that technique to hide my “source” assets.  See here for details about that:  http://forums.coronalabs.com/topic/35567-are-all-the-files-in-the-folder-included-in-the-app-or-only-files-referenced-by-the-app/

I hate doing manual workarounds like that because I like to automate everything, so I don’t have to remember manual steps, but I guess that’s going to have to be the technique I use if there is no support for this otherwise.  We really do need better options for “build profiles” or something like that because despite the goal of being multi-platform, we are always going to have rough spots like this.

Regarding submitting feedback… just did a little searching first in attempt to not duplicate a previous request and I found the following one (specifically about Android and iOS, but close enough for me):

http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/4027103-differentiate-android-and-ios-files

If you come across this post and are feeling that you would like a feature like this as well to help manage situations like this in a more efficient manor, you should cast a vote (or three) as well to help give this request the attention it needs.

Hi all,

It’s still somewhat “manual”, but if you use @AlanPlantPot’s folder setup (different folders for the different audio types), you can prefix one folder name (or the other) with a dot before you build. This will exclude it from going into the build… and realistically, you would only need to do that when you build your market-ready compilation.

Anyway, it’s not ideal, but it’s potentially easier than moving one or the other folder out of the project directory for the respective build.

Brent

I raised this point about a year ago, and it didn’t really get anywhere.

As far as I know, there is no way to get Corona to only include certain files, it’s all or nothing. The way I handled it was to put all of my oggs into a folder called “Android”, and my cafs into a folder called “iOS”. Then in my main.lua I do the following:

soundFolder = "" audioType = "" if system.getInfo('platformName') == "iPhone OS" then soundFolder = "iOS" audioType = ".caf" elseif system.getInfo('platformName') == "Mac OS X" then soundFolder = "iOS" audioType = ".caf" else soundFolder = "Android" audioType = ".ogg" end

Then the code for loading my sounds is:

local clickSound = audio.loadSound(soundFolder.."/click"..audioType)

When I want to build, I just drag the sound folder that I DON’T need out of the project.

I would much prefer being able to specify files or folders from the build menu, but in the meantime this worked for me.

+1 probably worth a post on feedback.coronalabs.com, unless somebody has already made a request.

Considering Corona’s strengths as a multi-format platform, this type of setup would certainly help.

For the record, the following blog post describes a suggestion on how to handle the audio file format issue:  http://www.coronalabs.com/blog/2013/03/26/androidizing-your-mobile-app/

I was considering using that technique in combination with a folder (similar to what Alan suggested).  At that point, you can just place a period (aka, dot) in front of the folder you want ignored when doing each build, and the build will ignore the contents and treat them as hidden.  I already use that technique to hide my “source” assets.  See here for details about that:  http://forums.coronalabs.com/topic/35567-are-all-the-files-in-the-folder-included-in-the-app-or-only-files-referenced-by-the-app/

I hate doing manual workarounds like that because I like to automate everything, so I don’t have to remember manual steps, but I guess that’s going to have to be the technique I use if there is no support for this otherwise.  We really do need better options for “build profiles” or something like that because despite the goal of being multi-platform, we are always going to have rough spots like this.

Regarding submitting feedback… just did a little searching first in attempt to not duplicate a previous request and I found the following one (specifically about Android and iOS, but close enough for me):

http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/4027103-differentiate-android-and-ios-files

If you come across this post and are feeling that you would like a feature like this as well to help manage situations like this in a more efficient manor, you should cast a vote (or three) as well to help give this request the attention it needs.

Hi all,

It’s still somewhat “manual”, but if you use @AlanPlantPot’s folder setup (different folders for the different audio types), you can prefix one folder name (or the other) with a dot before you build. This will exclude it from going into the build… and realistically, you would only need to do that when you build your market-ready compilation.

Anyway, it’s not ideal, but it’s potentially easier than moving one or the other folder out of the project directory for the respective build.

Brent