Skip to content

Commit 429ade1

Browse files
Adjustment from merge of upstream changes from AndroidBindings
1 parent e57448b commit 429ade1

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

sqlcipher/src/main/java/net/zetetic/database/sqlcipher/SQLiteOpenHelper.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -324,19 +324,18 @@ private SQLiteDatabase getDatabaseLocked(boolean writable) {
324324
} else if (mName == null) {
325325
db = SQLiteDatabase.create(null);
326326
} else {
327-
String path = mName;
328-
if (!path.startsWith("file:")) {
329-
path = mContext.getDatabasePath(path).getPath();
330-
}
331327
try {
332-
final File filePath = mContext.getDatabasePath(mName);
333-
final String path = filePath.getPath();
328+
String path = mName;
329+
if (!path.startsWith("file:")) {
330+
path = mContext.getDatabasePath(path).getPath();
331+
}
334332
/*
335333
Modified by Zetetic, newer Android OS versions will create the
336334
databases directory upon installation of the APK, whereas older
337335
versions, such as some devices running API 21 the databases directory
338336
does not exist.
339337
*/
338+
File filePath = new File(path);
340339
final File databasesDirectory = new File(filePath.getParent());
341340
if(!databasesDirectory.exists()){
342341
databasesDirectory.mkdirs();

0 commit comments

Comments
 (0)