Titanium Community Questions & Answer Archive

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

Best way to share code between 2 projects?

I have a project and it's free/iAd sibling. The apps are 90% the same. Is there a way to "include" code from outside the project? I was thinking of having my folders like:

  • App
  • App Free
  • App Shared

Ideally, "App" and "App Free" would "include" most of their code from the "App Shared" folder. Of course, I tried this and I got a "could not find the file" error. Is there another way to accomplish this?

— asked July 2nd 2010 by Donald Hughes
  • error
  • iphone
  • mobile

3 Answers

  • I decided to just create symbolic links in the Resources folders to the "App Shared" folder.

    — answered July 2nd 2010 by Donald Hughes
    • Actually, this is a failure. Although the Simulator can run it fine, once deployed to a device none of the code shared through the symlink is there. Back to the drawing board.

      — commented July 5th 2010 by Donald Hughes
    • Donald, could you fix this problem? I am having the same issue now…

      — commented December 13th 2010 by Ricardo Arguello
    • I patched /Library/Application Support/Titanium/mobilesdk/osx/1.6.2/iphone/compiler.py so it picks up symbolic links:

      Function "add_compiled_resources" -> replace os.walk(source) with os.walk(source, True, None, True)

      — commented August 14th 2011 by Christian Seiler
    • Here's the change in my fork: https://github.com/csmuc/titanium_mobile/commit/a9c451e381bab6bc3bbfdd8bf6a5bb7cb1d3db2e

      — commented August 17th 2011 by Christian Seiler
    • Christian, does your compiler.py update work on v1.8?

      — commented January 17th 2012 by George Hess
    • Just tried with 1.8.2 seems to work fine.

      — commented March 26th 2012 by Steve Rogers
    • Here is a link to an OSX symbolic link maker utility in case anyone finds it useful. Much easier than using Terminal to create them: http://seiryu.home.comcast.net/~seiryu/symboliclinker.html

      — commented May 11th 2013 by Peter Wiley
  • There's been a lot of talk about this on various forums generally.

    There's essentially 2 camps:

    1. 2 separate apps
    2. 1 app that allows itself to be upgrades

    The advantage of (2) is that you only have to maintain one release (so there's 1 review process, same version numbers, etc) and you don't compete against yourself on the marketplace.

    Essentially with (2) you provide users with a reg page inside the app, verify payment and return a unique key which you store in app properties. You can then check it periodically to see if it's valid.

    — answered July 2nd 2010 by David Ashwood
  • On Windows XP I tried using LinkShellExtension to create "virtual" folders that mirror a real folder. Unfortunately that caused a Windows error while packaging the Android APK.

    — answered June 14th 2013 by Wytze Schouten
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.