How to handle platform specific assets?

Hello,

I am using Creator 3.4.2
I am coming from Cocos2dx C++ so best thing about 2dx C++ was we can easily add macros in source files and those files wont be added in final binary.
May i know what will be the similar way of doing the same in Creator?
Not macros but what else we can do to achieve same?
Any automation while generating build via Command line?
Lets say platform specific we wont to change few assets as well then?

Thanks.
Regards,
Smit

@linrm So nothing possible for this?
Dont you think its required for cross-platform development?

you can add macros here in Creator :

build via Command line refer to: Publish from the Command Line · Cocos Creator

That i know, but its simple if/else, right?
code will be there in binaries.
And what about assets?

yes, its simple now.
I didn’t understand the question you mentioned about assets.

Suppose there are assets which is platform specific, then how we can handle that?

You need to determine the current system platform of the game. Use sys.platform, here is the API documentation for it: CocosCreatorAPI

The assets are then handled in different ways in different platforms.

@zzf_Cocos That i know but you are not getting my question properly.

  1. What if on Android platform i want to show logo_android.png and on iOS I want to show logo_ios.png its easy to display this by sys.platform but in android apk it will contain logo_ios.png as well, right? which will increase size of final build, so i want to know how we can avoid this?
    And this is just example, there might me lot of assets platform dependant.
  2. Now consider there are different constant files based on platforms.
    GameConstant_android.ts, GameConstant_iOS.ts etc how can we avoid extra files while building final builds?
    Also this constant file is just example but their might be lot of platform specific scripts which we need to avoid.
    Hopefully I am able to explain this now.
    I am coming from 2dx-cpp so it was very easy to achieve this.

What about split them into platform specific bundles?

That also i thought about, but bundles will be part of final build, right?
If its remote then it will be avoided.

it’s up to you, can upload them on Remote server and remove from build folder. I guess that you can handle it by custom build script.