diff options
author | Tor Lillqvist <tlillqvist@suse.com> | 2012-02-14 12:56:43 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2012-02-15 16:20:00 +0200 |
commit | 4eaf1feb56632e8e4da34c9a5275bd409395f009 (patch) | |
tree | f840c0071b3ac147a6d9e65b03d66d33ff77bba5 /sc | |
parent | 888d96f6b48a60abdf9077854f9a5f883f1e84be (diff) |
Special-case files in /assets on Android
Diffstat (limited to 'sc')
-rw-r--r-- | sc/CppunitTest_sc_filters_test.mk | 3 | ||||
-rw-r--r-- | sc/qa/unit/helper/qahelper.hxx | 15 |
2 files changed, 18 insertions, 0 deletions
diff --git a/sc/CppunitTest_sc_filters_test.mk b/sc/CppunitTest_sc_filters_test.mk index 26bcc7a3b5a9..32f7d47d8aaa 100644 --- a/sc/CppunitTest_sc_filters_test.mk +++ b/sc/CppunitTest_sc_filters_test.mk @@ -63,6 +63,9 @@ $(eval $(call gb_CppunitTest_add_linked_libs,sc_filters_test, \ utl \ vcl \ xo \ + $(if $(filter $(OS),ANDROID), \ + lo-bootstrap \ + ) \ $(gb_STDLIBS) \ )) 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: "); |