Skip to content

Commit

Permalink
Merge pull request #7607 from nitrag/master
Browse files Browse the repository at this point in the history
[TIMOB-20443] Android: Create or Open File in Ti.Database
  • Loading branch information
ashcoding committed Mar 11, 2016
2 parents 1ca9f9d + 293f123 commit 6c1be46
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,11 @@ public TiDatabaseProxy open(Object file)

try {
if (file instanceof TiFileProxy) {
// File support is read-only for now. The NO_LOCALIZED_COLLATORS flag means the database doesn't have Android metadata (i.e. vanilla)
TiFileProxy tiFile = (TiFileProxy) file;
String absolutePath = tiFile.getBaseFile().getNativeFile().getAbsolutePath();
Log.d(TAG, "Opening database from filesystem: " + absolutePath);

SQLiteDatabase db = SQLiteDatabase.openDatabase(absolutePath, null, SQLiteDatabase.OPEN_READONLY | SQLiteDatabase.NO_LOCALIZED_COLLATORS);
SQLiteDatabase db = SQLiteDatabase.openDatabase(absolutePath, null, SQLiteDatabase.CREATE_IF_NECESSARY | SQLiteDatabase.NO_LOCALIZED_COLLATORS);
dbp = new TiDatabaseProxy(db);
} else {
String name = TiConvert.toString(file);
Expand Down

0 comments on commit 6c1be46

Please sign in to comment.