summaryrefslogtreecommitdiff
path: root/sc/qa/unit/helper
diff options
context:
space:
mode:
authorTor Lillqvist <tlillqvist@suse.com>2012-02-14 12:56:43 +0200
committerTor Lillqvist <tml@iki.fi>2012-02-15 16:20:00 +0200
commit4eaf1feb56632e8e4da34c9a5275bd409395f009 (patch)
treef840c0071b3ac147a6d9e65b03d66d33ff77bba5 /sc/qa/unit/helper
parent888d96f6b48a60abdf9077854f9a5f883f1e84be (diff)
Special-case files in /assets on Android
Diffstat (limited to 'sc/qa/unit/helper')
-rw-r--r--sc/qa/unit/helper/qahelper.hxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx
index 4c9ae91d29c7..c679c73a4494 100644
--- a/sc/qa/unit/helper/qahelper.hxx
+++ b/sc/qa/unit/helper/qahelper.hxx
@@ -36,9 +36,24 @@
#include <string>
#include <sstream>
+#include <osl/detail/android-bootstrap.h>
+
void loadFile(const rtl::OUString& aFileName, std::string& aContent)
{
rtl::OString aOFileName = rtl::OUStringToOString(aFileName, RTL_TEXTENCODING_UTF8);
+
+#ifdef ANDROID
+ const char *contents;
+ size_t size;
+ if (strncmp(aOFileName.getStr(), "/assets/", sizeof("/assets/")-1) == 0) {
+ contents = (const char *) lo_apkentry(aOFileName.getStr(), &size);
+ if (contents != 0) {
+ aContent = std::string(contents, size);
+ return;
+ }
+ }
+#endif
+
std::ifstream aFile(aOFileName.getStr());
rtl::OStringBuffer aErrorMsg("Could not open csv file: ");