Things may have changed with the upcoming 4.0, but my experience with 3.0 was that the define function only allows literals in constant assignments.

This has definitely changed. In v4 you can use any valid expression in a constant definition.


What would be nice is to have some kind of library specific conditional where I could test if I was running on development or production

#IF (Some condition)
       define (BCRHOST;"bcr.mysite.com")
       define (ECRHOST;"ecr..mysite.com")
       define (TTSHOST;"tts.mysite.com")
       define (ERRHOST;"www.mysite.com")
#ELSE
       define (BCRHOST;"bcr.dev.mysite.com")
       define (ECRHOST;"ecr.dev.mysite.com")
       define (TTSHOST;"tts.dev.mysite.com")
       define (ERRHOST;"www.dev.mysite.com")
#END IF

Because define won't make an assignment based on an expression I can't do this: define (BCRHOST;choose (sometest;"bcr.dev.mysite.com";"bcr.mysite.com"))

Has anyone else had to deal with this situation and if so how did you solve it?

The way I deal with this is I create separate libraries for development and production with defines that set the correct values for each. Then in On Application Start I include the appropriate library. You should be able to tell if you are running on production or development based on the IP or something like that.

In v4 I deferred the running of On Application Startup so that the shell is completely initialized and you can examine <>A4D_HostAddr and <>A4D_HostPort to determine if you are running on a development or production machine.

Regards,

   Aparajita
   Victory-Heart Productions
   www.aparajitaworld.com

   "If you dare to fail, you are bound to succeed."
   - Sri Chinmoy   |   www.srichinmoylibrary.com

_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to