Preprocessor Directives and file paths, for different platforms?

I am a bit unclear as far as preprocessor directives, i.e. if I don’t want to manually change file locations in my scripts for iOS specific builds and or web builds to reference specific files OR web URL’s:
pseudo code:
#if (ios)
var URL=“
#if (my_web_regular_apache_Server)
var URL ="(localhost)/fileName"



Preprocessor directives? Methinks you have a background in C++! :wink: So you have a couple of examples there: detecting if you’re running on iOS and detecting if you’ve running from a certain URL (localhost in the example you give). Let’s take them in turn.

For detecting iOS, check out this StackOverflow thread.

For detecting if you’re running from localhost, check out this StackOverflow thread. So you’d essentially look for localhost in that window.location.href (or do a regex if you’re really thorough!) :smile:

1 Like

Yup Borland C++, I don’t know what else to call them. Awesome!

…script compilation order is a bit grey to me as of this moment because I intentionally avoided web development for the last 10 years - I had PTSD. :moneybag: :money_with_wings: :cry:

You might want to read this page in the User Manual on script load order:

This is useful if your project includes third party scripts like JQuery, say, that have to be loaded before anything else.

1 Like

great! Thanks looking at that now…I was using wrong verbage in searching for that, “script priority” instead of “script compilation order”.