From bf8af78973a798719b3241966a12bfc324990a5b Mon Sep 17 00:00:00 2001 From: John Reck Date: Tue, 18 Jan 2011 15:42:49 -0800 Subject: DO NOT MERGE - Create db path if it doesn't exit Bug: 3241808 Make sure the directory the caller is trying to open the icon db in actually exists and create it if it doesn't. Change-Id: Icc0a67b0ceba03a746ac2cd3b84fc34c2c8b4fe2 --- core/java/android/webkit/WebIconDatabase.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'core/java/android/webkit/WebIconDatabase.java') diff --git a/core/java/android/webkit/WebIconDatabase.java b/core/java/android/webkit/WebIconDatabase.java index bb9ec4888299..54dfab366d57 100644 --- a/core/java/android/webkit/WebIconDatabase.java +++ b/core/java/android/webkit/WebIconDatabase.java @@ -24,6 +24,7 @@ import android.os.Message; import android.provider.Browser; import android.util.Log; +import java.io.File; import java.util.HashMap; import java.util.Vector; @@ -194,13 +195,16 @@ public final class WebIconDatabase { /** * Open a the icon database and store the icons in the given path. * @param path The directory path where the icon database will be stored. - * @return True if the database was successfully opened or created in - * the given path. */ public void open(String path) { if (path != null) { + // Make the directories and parents if they don't exist + File db = new File(path); + if (!db.exists()) { + db.mkdirs(); + } mEventHandler.postMessage( - Message.obtain(null, EventHandler.OPEN, path)); + Message.obtain(null, EventHandler.OPEN, db.getAbsolutePath())); } } -- cgit v1.2.3