summaryrefslogtreecommitdiff
path: root/sal/android/libreofficekit-jni.c
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2014-07-01 13:46:19 +0200
committerJan Holesovsky <kendy@collabora.com>2014-07-01 13:48:28 +0200
commited52e65bcb639e4f1893817f4f3c9d698297fe3b (patch)
tree248c643be3e26e18da96a540a2b554dbefe132e8 /sal/android/libreofficekit-jni.c
parent7b66810f17c1000ac1d4dc3c5ba49842a0d146be (diff)
android: LibreOfficeKit needs the path to program/ as the starting point.
Change-Id: I7d4534649361e1bfa2c285e67e6765a4be55ec69
Diffstat (limited to 'sal/android/libreofficekit-jni.c')
-rw-r--r--sal/android/libreofficekit-jni.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/sal/android/libreofficekit-jni.c b/sal/android/libreofficekit-jni.c
index 4c9f20bff289..12bb3f99b26c 100644
--- a/sal/android/libreofficekit-jni.c
+++ b/sal/android/libreofficekit-jni.c
@@ -71,6 +71,10 @@ jboolean Java_org_libreoffice_kit_LibreOfficeKit_initializeNative
const char *cacheDirPath;
const char *apkFilePath;
+ const char program_dir[] = "/program";
+ size_t data_dir_len;
+ char *full_program_dir;
+
(void) clazz;
dataDirPath = (*env)->GetStringUTFChars(env, dataDir, NULL);
@@ -123,8 +127,17 @@ jboolean Java_org_libreoffice_kit_LibreOfficeKit_initializeNative
extract_files(UNPACK_TREE, UNPACK_TREE, 0);
extract_files(UNPACK_TREE_GZ, UNPACK_TREE_GZ, 1);
+ // LibreOfficeKit expects a path to the program/ directory
+ data_dir_len = strlen(data_dir);
+ full_program_dir = malloc(data_dir_len + sizeof(program_dir));
+
+ strncpy(full_program_dir, data_dir, data_dir_len);
+ strncpy(full_program_dir + data_dir_len, program_dir, sizeof(program_dir));
+
// Initialize LibreOfficeKit
- gpOffice = libreofficekit_hook(data_dir);
+ gpOffice = libreofficekit_hook(full_program_dir);
+
+ free(full_program_dir);
if (!gpOffice)
{
LOGE("libreofficekit_hook returned null");