{ "id": "62410", "key": "TIMOB-1778", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "11228", "name": "Release 1.5.0 M03", "archived": true, "released": true, "releaseDate": "2010-11-29" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:57:08.000+0000", "created": "2011-04-15T03:02:00.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "android", "feature" ], "versions": [], "issuelinks": [], "assignee": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2011-04-17T01:57:08.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "{html}
See Helpdesk\n42281. Add a method to TiBlob.getFile() that returns the\nunderlying file if it exists. If the TiBlob is not a reference to a\nfile return null
.
From the developer-facing API perspective, the right thing to do\nhere would be to return a FileProxy. However, TiBlob lives in the\ntitanium project (non-module), which to date has no references to\nour modules.
\nWhat do you think is the right way to handle this? Return a\nTiFile, which lacks API documentation?
Maybe we should just documenting returning a path that can be\npassed to the filesystem API to get a file object. Would that\nsuffice?
.nativePath it is.
Setting back to \"new\" while not working on it. Still have no\nidea how to get a file path from a content url, and sick of looking\nfor it for now.
(from [c5979f87e17694a280d1181d6aafeda399c42d52])\n[#1778 state:open] Give TiBlob a nativePath\nproperty, but still need it to handle content:// urls in such a way\nas to be useful to users wnating to create file proxies with it.\n\nhttps://github.com/appcelerator/titanium_mobile/commit/c5979f87e176...
(from [36832a4b1976704db3bc1c37120a6950d157039d])\n[#1778 state:fixed-in-qa] New .nativePath\nproperty will resolve content urls to paths \nhttps://github.com/appcelerator/titanium_mobile/commit/36832a4b1976...
Bear with me while I make a test case - coming soon
QA: here is an app.js you can use to test this. I'm morphing it\ninto a drillbit test as well, to be committed soon:
\n\nTitanium.UI.setBackgroundColor('#000');\nvar win = Titanium.UI.createWindow({ \n title:'Test',\n backgroundColor:'#fff',\n exitOnClose: true\n});\nwin.open()\n\nvar console = Ti.UI.createLabel({\n left:0, right:0, top: 0, height: 400,\n backgroundColor: 'black', color: 'white',\n font: {fontSize: 12}, verticalAlign: 'top'\n});\nwin.add(console);\n\nfunction w(s){\n if (console.text && console.text.length > 0) {\n console.text = console.text+ '\\n\\n* ' + s;\n } else {\n console.text = '* ' + s;\n }\n}\n\nvar filename = 'blobtest';\nvar testphrase = 'Revenge of the Blob';\n\nw('getting file with path segments ' + Ti.Filesystem.applicationDataDirectory + ', ' + filename);\n\nvar file = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, filename);\n\nif (file.exists()) {\n w('file exists. deleting it.');\n file.deleteFile();\n} else {\n w('file did not exist -- no need to delete it.');\n}\n\nw('putting text \"' + testphrase + '\" into file');\n\nfile.write(testphrase);\n\nw('getting blob based on file');\n\nvar blob = file.read();\n\nw('destroying original file variable instance to test getting it back via blob');\n\nfile = null;\n\nvar path = blob.nativePath;\n\nw(\"blob says file's path is \" + path);\nw(\"getting new file instance based on that path\");\nfile = Ti.Filesystem.getFile(path);\nif (file.exists()) {\n w(\"Good - file is said to exist when I get it from that path.\");\n w(\"Will read contents and see if they match the phrase we put in earlier.\");\n var readphrase = file.read().text;\n w('Read this text: \"' + readphrase + '\"');\n if (testphrase === readphrase) {\n w('Yay! The phrases match. TEST SUCCESSFUL');\n } else {\n w('FAIL! The phrases do not match. Something is wrong.');\n }\n} else {\n w(\"FAIL - file is said to not exist. Something is wrong.\");\n}
\n
(from [49374740a28357a89073e187edd5d57a99b0d296])\n[#1778][#2553] Unit test for new blob.nativePath\nproperty \nhttps://github.com/appcelerator/titanium_mobile/commit/49374740a283...
(from [cad3cbee2789d5bb34454a80e85d81bf451f73c4])\n[#1778][#2553] Unit test for new blob.nativePath\nproperty \nhttps://github.com/appcelerator/titanium_mobile/commit/cad3cbee2789...
G2 2.2 RC2. Bill you rock