From 10bcdb2eab81b5b9c893faf90f5bd9f396edeb4a Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Fri, 28 May 2010 11:08:34 +0100 Subject: Enable File Reader and blob.slice APIs. Notes: - the change to WebCore/html/FileStream.cpp is a cherry pick of http://trac.webkit.org/changeset/60325 - the change to WebCore/platform/posix/FileSystemPOSIX.cpp is a cherry pick of http://trac.webkit.org/changeset/60374 - this needs a corresponding frameworks/base change Change-Id: I05d1496e1e95adf1c6a61c6f07bbf62e9bc92820 --- WebCore/platform/android/FileSystemAndroid.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'WebCore/platform/android/FileSystemAndroid.cpp') diff --git a/WebCore/platform/android/FileSystemAndroid.cpp b/WebCore/platform/android/FileSystemAndroid.cpp index cf9830e..3513958 100644 --- a/WebCore/platform/android/FileSystemAndroid.cpp +++ b/WebCore/platform/android/FileSystemAndroid.cpp @@ -46,6 +46,12 @@ String sPluginPath; CString fileSystemRepresentation(const String& path) { + // If the path is a content:// URI then ask Java to resolve it for us. + if (path.startsWith("content://")) + return PlatformBridge::resolveFilePathForContentUri(path).utf8(); + else if (path.startsWith("file://")) + return path.substring(strlen("file://")).utf8(); + return path.utf8(); } @@ -107,13 +113,15 @@ Vector listDirectory(const String& path, const String& filter) return entries; } +// We define our own pathGetFileName rather than use the POSIX versions as we +// may get passed a content URI representing the path to the file. We pass +// the input through fileSystemRepresentation before using it to resolve it if +// it is a content URI. String pathGetFileName(const String& path) { - // If the path is a content:// URI then ask Java to resolve it for us. - if (path.startsWith("content://")) - return PlatformBridge::resolveFileNameForContentUri(path); - else - return path.substring(path.reverseFind('/') + 1); + CString fsRep = fileSystemRepresentation(path); + String fsPath = String(fsRep.data()); + return fsPath.substring(fsPath.reverseFind('/') + 1); } -- cgit v1.1