[TIMOB-17458] iOS: ApplicationSupportDirectory is not created when analytics are disabled
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Medium |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2015-03-16T16:37:29.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 4.1.0 |
| Components | iOS |
| Labels | n/a |
| Reporter | Ingo Muschenetz |
| Assignee | Pedro Enrique |
| Created | 2014-08-06T00:10:30.000+0000 |
| Updated | 2017-03-23T22:26:28.000+0000 |
Description
Steps to reproduce:
Create a new Titanium application
Disable analytics is tiapp.xml
Attempt to write to the Ti.Filesystem.getApplicationSupportDirectory(). It will fail (as the directory does not exist).
Another way to confirm:
var self = Ti.Filesystem.getApplicationSupportDirectory();
console.log(self);
[INFO] file:///Users/stephenfeather/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/1E1EB9EC-2997-4FD2-8618-41E5EA522A54/Library/Application%20Support/
Immediate workaround is to create that folder manually, but it should be created automatically.
PR provided to create directory after boot in TiApp PR: https://github.com/appcelerator/titanium_mobile/pull/6729 Test : https://gist.github.com/benbahrenburg/9adb20ded6e2fe218a11
Test code:
Steps to verify 1. Create a new ti project 2. Before compiling turn off analytics 4. Create a new app and paste the codevar dir = Ti.Filesystem.getApplicationSupportDirectory(); console.log(dir); var f = Titanium.Filesystem.getFile(Ti.Filesystem.applicationSupportDirectory); console.log('Directory Exists: '+ (f.exists() ? 'Yes' : 'No')); console.log('Needs to be yes to pass')); var testfile = Ti.Filesystem.getFile(Ti.Filesystem.applicationSupportDirectory, 'text.txt'); if(testfile.exists()){ testfile.deleteFile(); } testfile.write("text written via write()\n"); console.log("Check file at:" + testfile.nativePath); console.log('content needs to be there to pass'));Closing as fixed.