[Libreoffice-commits] .: 2 commits - android/experimental sal/android sal/inc sal/rtl

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Nov 22 04:16:10 PST 2012


 android/experimental/LibreOffice4Android/Makefile |   19 +++++++++----------
 sal/android/lo-bootstrap.c                        |    7 +++++++
 sal/inc/osl/detail/android-bootstrap.h            |    2 ++
 sal/rtl/source/bootstrap.cxx                      |   12 ++++++++++++
 4 files changed, 30 insertions(+), 10 deletions(-)

New commits:
commit 129831703f0539bf06279f47f915098e5a7287f8
Author: Tor Lillqvist <tml at iki.fi>
Date:   Thu Nov 22 14:01:42 2012 +0200

    Add an $APP_DATA_DIR predefiend thingie in bootstrap ("rc") files for Android
    
    It expands to what lo_get_app_data_dir() returns, i.e. the activity's
    getApplicationInfo().dataDir.
    
    Use it in the LibreOffice4Android app's rc files instead of a
    hardcoded (possibly device- and/or OS version dependent) path.
    
    Change-Id: I8145f2c86eeded39232fb251a79fa64f31f77f55

diff --git a/android/experimental/LibreOffice4Android/Makefile b/android/experimental/LibreOffice4Android/Makefile
index 8a57055..ea5fbeb 100644
--- a/android/experimental/LibreOffice4Android/Makefile
+++ b/android/experimental/LibreOffice4Android/Makefile
@@ -45,9 +45,8 @@ copy-stuff:
 	gzip -9 <$(OUTDIR)/bin/types.rdb >assets/gz.unpack/program/types.rdb
 	gzip -9 <$(OUTDIR)/bin/ure/types.rdb >assets/gz.unpack/program/ure/types.rdb
 # For some reason the vnd.sun.star.expand:$LO_LIB_DIR doesn't seem to work, it expands to empty!?
-# So just hardcode the known APP_DATA_PATH for now...
 	for F in xml/services xml/ure/services; do \
-		sed -e 's!uri="vnd.sun.star.expand:$$LO_LIB_DIR/!uri="file://$(APP_DATA_PATH)/lib/!g' <$(OUTDIR)/$$F.rdb >assets/$$F.rdb; \
+		sed -e 's!uri="vnd.sun.star.expand:$$LO_LIB_DIR/!uri="file://$$APP_DATA_DIR/lib/!g' <$(OUTDIR)/$$F.rdb >assets/$$F.rdb; \
 	done
 	cp $(SRC_ROOT)/odk/examples/java/DocumentHandling/test/test1.odt \
 	   $(SRC_ROOT)/sc/qa/unit/data/xls/border.xls \
@@ -72,30 +71,30 @@ copy-stuff:
 	echo 'NativeProgress=1' >> assets/rc
 	echo 'URE_BOOTSTRAP=file:///assets/program/fundamentalrc' >> assets/rc
 #	echo 'RTL_LOGFILE=file:///dev/log/main' >> assets/rc
-	echo "HOME=$(APP_DATA_PATH)/cache" >> assets/rc
-	echo "OSL_SOCKET_PATH=$(APP_DATA_PATH)/cache" >> assets/rc
+	echo 'HOME=$$APP_DATA_DIR/cache' >> assets/rc
+	echo 'OSL_SOCKET_PATH=$$APP_DATA_DIR/cache' >> assets/rc
 #
 # Set up fundamentalrc
 	echo '[Bootstrap]' > assets/program/fundamentalrc
-	echo "LO_LIB_DIR=file:$(APP_DATA_PATH)/lib/" >> assets/program/fundamentalrc
-	echo "URE_LIB_DIR=file://$(APP_DATA_PATH)/lib/" >> assets/program/fundamentalrc # checkme - is this used to find configs ?
+	echo 'LO_LIB_DIR=file://$$APP_DATA_DIR/lib/' >> assets/program/fundamentalrc
+	echo 'URE_LIB_DIR=file://$$APP_DATA_DIR/lib/' >> assets/program/fundamentalrc # checkme - is this used to find configs ?
 	echo 'BRAND_BASE_DIR=file:///assets' >> assets/program/fundamentalrc
 	echo 'CONFIGURATION_LAYERS=xcsxcu:$${BRAND_BASE_DIR}/share/registry module:$${BRAND_BASE_DIR}/share/registry/modules res:$${BRAND_BASE_DIR}/share/registry' >> assets/program/fundamentalrc
 	echo 'URE_BIN_DIR=file:///assets/ure/bin/dir/not-here/can-we/exec-anyway' >> assets/program/fundamentalrc
-	echo 'URE_MORE_TYPES=$(APP_DATA_PATH)/program/offapi.rdb $(APP_DATA_PATH)/program/oovbaapi.rdb' >> assets/program/fundamentalrc
+	echo 'URE_MORE_TYPES=$$APP_DATA_DIR/program/offapi.rdb $$APP_DATA_DIR/program/oovbaapi.rdb' >> assets/program/fundamentalrc
 	echo 'URE_MORE_SERVICES=file:///assets/xml/services.rdb <$$BRAND_BASE_DIR/program/services>*' >> assets/program/fundamentalrc
 #
 # Set up unorc
 	echo '[Bootstrap]' > assets/program/unorc
-	echo "URE_INTERNAL_LIB_DIR=file://$(APP_DATA_PATH)/lib/" >> assets/program/unorc
-	echo 'UNO_TYPES=$(APP_DATA_PATH)/program/ure/types.rdb $(APP_DATA_PATH)/program/types.rdb $${URE_MORE_TYPES}' >> assets/program/unorc
+	echo 'URE_INTERNAL_LIB_DIR=file://$$APP_DATA_DIR/lib/' >> assets/program/unorc
+	echo 'UNO_TYPES=$$APP_DATA_DIR/program/ure/types.rdb $$APP_DATA_DIR/program/types.rdb $${URE_MORE_TYPES}' >> assets/program/unorc
 	echo 'UNO_SERVICES=file:///assets/xml/ure/services.rdb $${URE_MORE_SERVICES}' >> assets/program/unorc
 #
 # Set up bootstraprc
 	echo '[Bootstrap]' > assets/program/bootstraprc
 	echo 'InstallMode=<installmode>' >> assets/program/bootstraprc
 	echo 'ProductKey=LibreOffice 3.6' >> assets/program/bootstraprc
-	echo "UserInstallation=file://$(APP_DATA_PATH)" >> assets/program/bootstraprc
+	echo 'UserInstallation=file://$$APP_DATA_DIR' >> assets/program/bootstraprc
 #
 # Set up versionrc
 	echo '[Version]' > assets/program/versionrc
diff --git a/sal/rtl/source/bootstrap.cxx b/sal/rtl/source/bootstrap.cxx
index 4d9f190..1f293b5 100644
--- a/sal/rtl/source/bootstrap.cxx
+++ b/sal/rtl/source/bootstrap.cxx
@@ -40,6 +40,10 @@
 #include <boost/unordered_map.hpp>
 #include <list>
 
+#ifdef ANDROID
+#include <osl/detail/android-bootstrap.h>
+#endif
+
 #ifdef IOS
 #include <premac.h>
 #import <Foundation/Foundation.h>
@@ -509,6 +513,14 @@ bool Bootstrap_Impl::getValue(
              pData));
         return true;
     }
+#ifdef ANDROID
+    if (key == "APP_DATA_DIR") {
+        const char *app_data_dir = lo_get_app_data_dir();
+        rtl_uString_assign(
+            value, rtl::OUString(app_data_dir, strlen(app_data_dir), RTL_TEXTENCODING_UTF8).pData);
+        return true;
+    }
+#endif
     if (key == "ORIGIN") {
         rtl_uString_assign(
             value,
commit 9cb4f96790a28470829a5aff11e8b2dd8e94c40b
Author: Tor Lillqvist <tml at iki.fi>
Date:   Thu Nov 22 13:39:58 2012 +0200

    Add lo_get_app_data_dir()
    
    Change-Id: I13ab54ce5c6d67f1623b7f1923678091660d202d

diff --git a/sal/android/lo-bootstrap.c b/sal/android/lo-bootstrap.c
index b03a609..61f2c76 100644
--- a/sal/android/lo-bootstrap.c
+++ b/sal/android/lo-bootstrap.c
@@ -1250,4 +1250,11 @@ lo_get_javavm(void)
     return the_java_vm;
 }
 
+__attribute__ ((visibility("default")))
+const char *
+lo_get_app_data_dir(void)
+{
+    return data_dir;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/inc/osl/detail/android-bootstrap.h b/sal/inc/osl/detail/android-bootstrap.h
index 56c7c3d..672536f 100644
--- a/sal/inc/osl/detail/android-bootstrap.h
+++ b/sal/inc/osl/detail/android-bootstrap.h
@@ -60,6 +60,8 @@ int lo_dlcall_argc_argv(void *function,
 
 JavaVM *lo_get_javavm(void);
 
+const char *lo_get_app_data_dir(void);
+
 #ifdef __cplusplus
 }
 #endif


More information about the Libreoffice-commits mailing list