Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

How Does Titanium Resolve Location of JavaScript Window Files


If I have code like this in app.js:

var loginWindow = Ti.UI.createWindow({
        url: "login/login.js",
        title: "Login",
        barColor: "#FF840F"

Apparently, Appcelerator will first look in the platform-specific directory for that file. For example, on Android, it will first look in /Resources/android/login/login.js for the file. If it isn't found, it will look in /Resources/login/login.js for the file.

I learned this the rule the hard way when building some screens. Can somebody please point me to where this rule is "officially" documented so I can see if there is anything else I missed? For example, are images also searched this way? What is and isn't searched this way?

— asked September 8th 2010 by Ryan Asleson
  • android
  • iphone

1 Answer

  • Accepted Answer

    During build time files in the platform directory overwrite the same files in the root directory. So if you're building for Android and have login.js in the android folder that is the one used on Android devices. Same for iPhone only in the iPhone directory. If neither platform directory provides a copy of the file then the one in the root dir is shipped with the app.

    — answered September 8th 2010 by Don Thorp
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.