Titanium Packager Class VFS
As you may know, Titanium loads itself into the global space. This means, Titanium is loaded once. This prevents a few things from happening:
- Firstly, it stops classes from being overwritten by others with the same name.
- It ensures variables stored in a classes
statictable is shared across all applications.
- It speeds the computer up by eliminating the need to load Titanium every time an application starts.
This comes with a drawback that needs to be addressed in a simple, effective manner. The drawback, is that projects built with the Titanium packager use a custom file system so that the VFS (virtual file system) is used. However, Titanium does not respect this and as a result doesn't query the VFS for files.
This means, projects built the packager cannot be distributed as
fs calls from within Titanium will not use the virtual file system and will report 'file not found', resulting in an exception. One solution, is that all
fs calls from within an application require a
FileSystem instance, which will be automatically created by
Application instances or manually created by daemon services that don't require an