{ "id": "88232", "key": "TIMOB-10223", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "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": "15927", "description": "2014 Sprint 04", "name": "2014 Sprint 04", "archived": true, "released": true, "releaseDate": "2014-02-28" }, { "id": "15929", "description": "2014 Sprint 04 API", "name": "2014 Sprint 04 API", "archived": true, "released": true, "releaseDate": "2014-02-28" }, { "id": "15971", "description": "Release 3.2.3", "name": "Release 3.2.3", "archived": false, "released": true, "releaseDate": "2014-04-30" }, { "id": "15422", "description": "Release 3.3.0", "name": "Release 3.3.0", "archived": false, "released": true, "releaseDate": "2014-07-16" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-02-21T22:35:51.000+0000", "created": "2012-03-20T08:31:03.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "api", "exalture", "qe-testadded", "supportTeam" ], "versions": [ { "id": "15593", "description": "Release 3.1.3", "name": "Release 3.1.3", "archived": true, "released": true, "releaseDate": "2013-09-18" } ], "issuelinks": [], "assignee": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "updated": "2017-05-26T01:19:28.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": "h4. Problem Description\r\n\r\nI'm trying to use Ti.Database.Install() to install on the SD card.\r\nFollowing the example in:\r\n\r\nhttp://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Database.install-method.html\r\n\r\nthe code is:\r\n\r\n{code}\r\nvar db = Ti.Database.install(\"/mydb\", Ti.Filesystem.externalStorageDirectory + \"mydb\");\r\n{code}\r\n\r\nh4. Actual Results\r\nI always get\r\n\r\n{code}\r\nE/TiJSError( 552): (main) [1997,4200] ----- Titanium Javascript Runtime Error -----\r\nE/TiJSError( 552): (main) [1,4201] - In ti:/invoker.js:92,19\r\nE/TiJSError( 552): (main) [0,4201] - Message: Uncaught Error: File appdata://mydb contains a path separator\r\nE/TiJSError( 552): (main) [0,4201] - Source:\r\nreturn delegate.apply(invoker.__thisObj__, args);\r\nE/V8Exception( 552): Exception occurred at ti:/invoker.js:92: Uncaught Error: File appdata://mydb contains a path separator\r\n{code}\r\n\r\nh4. Expected Results\r\nThe example working\r\n\r\nh4. Extra info\r\nI've also tried:\r\n\r\n{code}\r\nvar db = Ti.Database.install(\"/mydb\", Ti.Filesystem.getFile(Ti.Filesystem.externalStorageDirectory + \"mydb\").nativePath);\r\n{code}\r\n\r\nwhich gives a similar error:\r\n\r\n{code}\r\nE/TiJSError( 671): (main) [1945,3930] ----- Titanium Javascript Runtime Error -----\r\nE/TiJSError( 671): (main) [1,3931] - In ti:/invoker.js:92,19\r\nE/TiJSError( 671): (main) [0,3931] - Message: Uncaught Error: File file:///mnt/sdcard/com.my.org.myapp/mydb contains a path separator\r\nE/TiJSError( 671): (main) [0,3931] - Source: \t\treturn delegate.apply(invoker.__thisObj__, args);\r\nE/V8Exception( 671): Exception occurred at ti:/invoker.js:92: Uncaught Error: File file:///mnt/sdcard/com.my.org.myapp/mydb contains a path separator\r\n{code}\r\n\r\nI've also tried formatting the SD and recreating it from scratch. The results don't change.\r\n\r\nIs there any way to copy/open the db on the external storage on Android?\r\n", "attachment": [], "flagged": false, "summary": "Android: \"Uncaught Error: File: appdata://XYZ contains a path separator\" on Android when using Ti.Database.Install with Ti.Filesystem.externalStorageDirectory", "creator": { "name": "panta", "key": "panta", "displayName": "Marco Pantaleoni", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "panta", "key": "panta", "displayName": "Marco Pantaleoni", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Mac OS X Lion 10.7.3, Titanium SDK 1.8.3, Android SDK 2.2 (API 7) (emulator)\r\n\r\nTiSDK 3.1.3.GA & Android Razr 2.3.5", "comment": { "comments": [ { "id": "210345", "author": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "body": "@Marco - Why are you using a slash in the first parameter name?", "updateAuthor": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-07-27T23:36:08.000+0000", "updated": "2012-07-27T23:36:08.000+0000" }, { "id": "210374", "author": { "name": "clathrop", "key": "clathrop", "displayName": "Carter Lathrop", "active": true, "timeZone": "America/Los_Angeles" }, "body": "the slash doesnt change anything. I tried out the same call with 'mydb' instead of '/mydb' and the error still occurs", "updateAuthor": { "name": "clathrop", "key": "clathrop", "displayName": "Carter Lathrop", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-07-28T15:23:36.000+0000", "updated": "2012-07-28T15:23:36.000+0000" }, { "id": "210386", "author": { "name": "panta", "key": "panta", "displayName": "Marco Pantaleoni", "active": true, "timeZone": "America/Los_Angeles" }, "body": "@Neeraj: as Carter said, the initial slash doesn't change the results.\r\nI'd also like to point out that the API docs have the parameter order reversed, citing \"install(String path, String dbName)\" instead of \"install(String dbName, String path)\".\r\n", "updateAuthor": { "name": "panta", "key": "panta", "displayName": "Marco Pantaleoni", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-07-30T01:02:14.000+0000", "updated": "2012-07-30T01:02:14.000+0000" }, { "id": "210629", "author": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thanks, Marco.", "updateAuthor": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-07-30T22:36:56.000+0000", "updated": "2012-07-30T22:36:56.000+0000" }, { "id": "221607", "author": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Workaround : Use absolute path of the SD card.\n{code}\nvar db2 = Ti.Database.open('/mnt/sdcard/com.app.testme/databases/mydb2Installed');\n{code}\nwhere com.app.testme is the appid.\n\nRegards,\nAnirudh", "updateAuthor": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-10-01T18:11:36.000+0000", "updated": "2012-10-01T18:11:36.000+0000" }, { "id": "228820", "author": { "name": "florian54000", "key": "florian54000", "displayName": "Florian Sey", "active": true, "timeZone": "Europe/Berlin" }, "body": "Does this workaround works with Ti.Database.install(dbName, path); ?\r\nI'm trying to install an already existing database from the Resources folder to the 'data' folder of the device. It works fine on iOS. \r\nBut with Android, I get the same error as above following the doc. \r\nI tried the workaround, but I always get a No such file or directory error message. \r\nHere the paths I tested: \r\n/mnt/sdcard/com.company.app/mydb\r\n/mnt/sdcard/com.company.app/databases/mydb\r\n/mnt/sdcard/mydb\r\n/sdcard/com.company.app/mydb\r\n/sdcard/com.company.app/databases/mydb\r\n/sdcard/mydb\r\n\r\nI'm not familiar with the filesystem on Android though so maybe I missed something. \r\nShould I create folder first? Is com.company.app automatically created? \r\n(I ofcourse replaced com.company.app with the right app id inside the project)\r\n", "updateAuthor": { "name": "florian54000", "key": "florian54000", "displayName": "Florian Sey", "active": true, "timeZone": "Europe/Berlin" }, "created": "2012-11-28T13:57:30.000+0000", "updated": "2012-11-28T13:57:30.000+0000" }, { "id": "231188", "author": { "name": "mark.henderson@snagr.co.uk", "key": "mark.henderson@snagr.co.uk", "displayName": "Mark Henderson", "active": true, "timeZone": "Europe/London" }, "body": "Can I please champion this issue to be prioritised thanks!", "updateAuthor": { "name": "mark.henderson@snagr.co.uk", "key": "mark.henderson@snagr.co.uk", "displayName": "Mark Henderson", "active": true, "timeZone": "Europe/London" }, "created": "2012-12-13T10:00:05.000+0000", "updated": "2012-12-13T10:00:05.000+0000" }, { "id": "275544", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "body": "I've also tried out to hard code path to DB without success. Furthermore, probably 'Resources' folder might be copied over external storage directory.\nh6.e.g.\n{quote}\nvar db = Ti.Database.install( '/testdb', '/mnt/sdcard/com.app.test/databases/testdb' ); \n10-17 17:20:41.398: W/System.err(5072): java.io.FileNotFoundException: Resources/testdb\n{quote}\n\nFollowing Appcelerator docs does not seem to work this out:\n- http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.Database-method-install\n\nh6.Install a Database to External Storage (Android)\n{quote}\nThe device is checked for the presence of external storage and a database, with a filename of mydb2 and located in the same directory as the the running script, is installed.\n{quote}\n\n{quote}\nif (Ti.Platform.name === 'android' && Ti.Filesystem.isExternalStoragePresent()) {\n var db2 = Ti.Database.install('mydb2', Ti.Filesystem.externalStorageDirectory + 'path' + Ti.Filesystem.separator + 'to' + Ti.Filesystem.separator + 'mydb2Installed');\n}\n\nUnlike on iOS, no file extension is added. The file is copied to the absolute path provided.\n{quote}\n\n", "updateAuthor": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-10-17T23:12:22.000+0000", "updated": "2013-10-17T23:12:22.000+0000" }, { "id": "292697", "author": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Added code to handle external directory. Also make sure that if the db doesn't exist, don't copy.\r\n\r\nhttps://github.com/appcelerator/titanium_mobile/pull/5347", "updateAuthor": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-02-12T16:47:11.000+0000", "updated": "2014-02-12T16:47:11.000+0000" }, { "id": "298477", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "3_2_X Backport PR: https://github.com/appcelerator/titanium_mobile/pull/5509", "updateAuthor": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-03-24T20:34:19.000+0000", "updated": "2014-03-24T20:46:00.000+0000" }, { "id": "298896", "author": { "name": "sdowse", "key": "sdowse", "displayName": "Samuel Dowse", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed on:\r\nMac OSX 10.9.2\r\nAppcelerator Studio, build: 3.2.3.201403250634\r\nTitanium SDK, build: 3.2.3.v20140326130916\r\nCLI: 3.2.3-dev\r\nAlloy: 1.3.1\r\nAndroid Device: Galaxy SIII (4.1.2, with external sdcard)\r\n\r\nUsed the following code:\r\n{code}\r\nvar db \t= Ti.Database.install('mydb', 'mydb1Installed');\r\nvar db1 = Ti.Database.install('mydb1', Ti.Filesystem.externalStorageDirectory + 'mydb1');\r\nvar db2 = Ti.Database.install( '/mydb2', '/mnt/sdcard/com.appcelerator.timob10223/databases/mydb2' ); \r\n{code}\r\nAll three successfully save db files to sdcard.\r\nClosing.", "updateAuthor": { "name": "sdowse", "key": "sdowse", "displayName": "Samuel Dowse", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-03-26T23:59:56.000+0000", "updated": "2014-03-27T00:00:41.000+0000" }, { "id": "420476", "author": { "name": "jfalcone", "key": "jfalcone", "displayName": "Joe Falcone", "active": true, "timeZone": "America/Los_Angeles" }, "body": "We've just run into this bug in Ti.Database.open... with 5.5.1 SDK on Android 7.0 - just change the code above to Ti.Database.open and you get the \"contains a path separator\" error\r\n\r\nvar db1 = Ti.Database.open(Ti.Filesystem.externalStorageDirectory + 'mydb1');\r\n\r\nSounds like the bug was fixed in install, but not in open.\r\n\r\nWorkaround is to copy the file from externalStorageDirectory to applicationCacheDirectory and then use Ti.Database.install to re-install it so as to preserve the data.", "updateAuthor": { "name": "jfalcone", "key": "jfalcone", "displayName": "Joe Falcone", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-05-26T01:19:28.000+0000", "updated": "2017-05-26T01:19:28.000+0000" } ], "maxResults": 13, "total": 13, "startAt": 0 } } }