define(["Ti/_","Ti/_/Evented","Ti/_/lang","Ti/Filesystem/File"],function(t,e,r,n){function i(){var t,e=/(.+:\/\/)?(.*)/,n="",i=[],a=r.toArray(arguments).filter(function(t){return void 0!==t}).map(function(t){return n||(n=t.match(e))&&(n=n[1]||""),t.replace(n,"").replace(/^\/|\/$/g,"")}).join("/");return a.split("/").forEach(function(e){if(".."===e&&".."!==t){if(!i.length)throw new Error('Irrational path "'+a+'"');i.pop(),t=i[i.length-1]}else e&&"."!==e&&i.push(t=e)}),a=n+i.join("/"),n||/^\//.test(a)||(a="/"+a),a}function a(e){var r=new n({_type:e.charAt(0),nativePath:u+t.uuid()});return r["create"+e]()?r:null}var o="appdata://",u="tmp://";return r.setObject("Ti.Filesystem",e,{constants:{MODE_APPEND:4,MODE_READ:1,MODE_WRITE:2,applicationDataDirectory:o,lineEnding:"\n",resourcesDirectory:"/",separator:"/",tempDirectory:u},protocols:["appdata","tmp"],createTempDirectory:function(){return a("Directory")},createTempFile:function(){return a("File")},getFile:function(){return new n(i.apply(null,arguments))},isExternalStoragePresent:function(){return!1},openStream:function(t){var e,a=r.toArray(arguments);return a.shift(),e=new n(i.apply(null,a)),e.open(t)}})});