I was working on a project in Titanium this weekend, and I crossed the limit of my laziness.
I had certain files(JS) which I almost need in all my project, so every time I create a project I had to include them or add them to my project.
I thought why don't this process be automated, means whenever I create any project "My files" should automatically get added to my project.
So in this tutorial I will tell you "How to hack the Titanium SDK" to achieve the same
Caution: Modifying the SDK files in not a good option unless you are sure what you are doing"
So open up your Titanium SDK directory.
In my MAC it is
Root Directory --> Library --> Application Support -->Titanium --> mobilesdk -->osx
And there you find all your Titanium SDK files.
I choose SDK 1.7.5, so back up your SDK so that in case anything goes wrong.
Open up SDK 1.7.5, you will see below files and folders
From these bunch of files we are interested in folder named "all" and file named "project.py".
project.py is a python based file.
Now create a folder in "all" folder say "MyFiles" and paste all your necessary JS files or images, anything in it.
Lets do the Hack
Open up the project.py file.
Make sure you have a python editor, as python is totally based on indentation, so while changing the python file you might get "indentation error", so dont be panic-"I was for first time".
I edited the project.py file in my Titanium studio. But you can easily see the code in your Xcode also
Now you have file opened-
browse through the code...
I had certain files(JS) which I almost need in all my project, so every time I create a project I had to include them or add them to my project.
I thought why don't this process be automated, means whenever I create any project "My files" should automatically get added to my project.
So in this tutorial I will tell you "How to hack the Titanium SDK" to achieve the same
Caution: Modifying the SDK files in not a good option unless you are sure what you are doing"
So open up your Titanium SDK directory.
In my MAC it is
Root Directory --> Library --> Application Support -->Titanium --> mobilesdk -->osx
And there you find all your Titanium SDK files.
I choose SDK 1.7.5, so back up your SDK so that in case anything goes wrong.
Open up SDK 1.7.5, you will see below files and folders
From these bunch of files we are interested in folder named "all" and file named "project.py".
project.py is a python based file.
Now create a folder in "all" folder say "MyFiles" and paste all your necessary JS files or images, anything in it.
Lets do the Hack
Open up the project.py file.
Make sure you have a python editor, as python is totally based on indentation, so while changing the python file you might get "indentation error", so dont be panic-"I was for first time".
I edited the project.py file in my Titanium studio. But you can easily see the code in your Xcode also
Now you have file opened-
The highlighted code is adding "Resource" directory to the project.
So below that highlighted code we will add our code.
Here what your project.py will look after adding the code
Here we are just getting the folder "MyFiles" that we created in "all" folder and copying it to the "Resource" folder of our project.
Now save your project.py file and lets create a new Titanium project using our edited SDK i.e 1.7.5
Here I have created a project named "SDKhack" choosing the Titanium 1.7.5 SDK, which we edited.
And now after creating the project I have my "MyFiles" folder with all the files automatically added to my Project.
Thats All for Now, Thank you..
No comments:
Post a Comment