Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
4a8666cc
Kaydet (Commit)
4a8666cc
authored
Ock 11, 2012
tarafından
Tor Lillqvist
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add unpacking of files from assets/unpack to the data dir
üst
e6a32a0d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
118 additions
and
0 deletions
+118
-0
lo-bootstrap.c
sal/android/lo-bootstrap.c
+118
-0
No files found.
sal/android/lo-bootstrap.c
Dosyayı görüntüle @
4a8666cc
...
@@ -71,6 +71,7 @@ struct engine {
...
@@ -71,6 +71,7 @@ struct engine {
};
};
static
struct
android_app
*
app
;
static
struct
android_app
*
app
;
static
const
char
*
data_dir
;
static
const
char
**
library_locations
;
static
const
char
**
library_locations
;
static
void
*
apk_file
;
static
void
*
apk_file
;
static
int
apk_file_size
;
static
int
apk_file_size
;
...
@@ -475,6 +476,8 @@ Java_org_libreoffice_android_Bootstrap_setup__Ljava_lang_String_2Ljava_lang_Stri
...
@@ -475,6 +476,8 @@ Java_org_libreoffice_android_Bootstrap_setup__Ljava_lang_String_2Ljava_lang_Stri
dataDirPath
=
(
*
env
)
->
GetStringUTFChars
(
env
,
dataDir
,
NULL
);
dataDirPath
=
(
*
env
)
->
GetStringUTFChars
(
env
,
dataDir
,
NULL
);
data_dir
=
strdup
(
dataDirPath
);
lib_dir
=
malloc
(
strlen
(
dataDirPath
)
+
5
);
lib_dir
=
malloc
(
strlen
(
dataDirPath
)
+
5
);
strcpy
(
lib_dir
,
dataDirPath
);
strcpy
(
lib_dir
,
dataDirPath
);
strcat
(
lib_dir
,
"/lib"
);
strcat
(
lib_dir
,
"/lib"
);
...
@@ -1312,6 +1315,119 @@ patch_libgnustl_shared(void)
...
@@ -1312,6 +1315,119 @@ patch_libgnustl_shared(void)
&
replacement_method_before_arm
);
&
replacement_method_before_arm
);
}
}
#define UNPACK_TREE "/assets/unpack"
static
int
mkdir_p
(
const
char
*
dirname
)
{
char
*
p
=
malloc
(
strlen
(
dirname
)
+
1
);
const
char
*
q
=
dirname
+
1
;
const
char
*
slash
;
do
{
slash
=
strchr
(
q
,
'/'
);
if
(
slash
==
NULL
)
slash
=
q
+
strlen
(
q
);
memcpy
(
p
,
dirname
,
slash
-
dirname
);
p
[
slash
-
dirname
]
=
'\0'
;
if
(
mkdir
(
p
,
0700
)
==
-
1
&&
errno
!=
EEXIST
)
{
LOGE
(
"mkdir_p: Could not create %s: %s"
,
p
,
strerror
(
errno
));
free
(
p
);
return
0
;
}
if
(
*
slash
)
q
=
slash
+
1
;
}
while
(
*
slash
);
free
(
p
);
return
1
;
}
static
void
extract_files
(
const
char
*
prefix
)
{
lo_apk_dir
*
tree
=
lo_apk_opendir
(
prefix
);
struct
dirent
*
dent
;
if
(
tree
==
NULL
)
return
;
while
((
dent
=
lo_apk_readdir
(
tree
))
!=
NULL
)
{
if
(
strcmp
(
dent
->
d_name
,
"."
)
==
0
||
strcmp
(
dent
->
d_name
,
".."
)
==
0
)
continue
;
if
(
dent
->
d_type
==
DT_DIR
)
{
char
*
subdir
=
malloc
(
strlen
(
prefix
)
+
1
+
strlen
(
dent
->
d_name
)
+
1
);
strcpy
(
subdir
,
prefix
);
strcat
(
subdir
,
"/"
);
strcat
(
subdir
,
dent
->
d_name
);
extract_files
(
subdir
);
free
(
subdir
);
}
else
{
char
*
filename
;
char
*
newfilename
;
const
char
*
apkentry
;
size_t
size
;
struct
stat
st
;
FILE
*
f
;
filename
=
malloc
(
strlen
(
prefix
)
+
1
+
strlen
(
dent
->
d_name
)
+
1
);
strcpy
(
filename
,
prefix
);
strcat
(
filename
,
"/"
);
strcat
(
filename
,
dent
->
d_name
);
apkentry
=
lo_apkentry
(
filename
,
&
size
);
if
(
apkentry
==
NULL
)
{
LOGE
(
"extract_files: Could not find %s in .apk"
,
newfilename
);
free
(
filename
);
continue
;
}
newfilename
=
malloc
(
strlen
(
data_dir
)
+
1
+
strlen
(
prefix
)
-
sizeof
(
UNPACK_TREE
)
+
1
+
strlen
(
dent
->
d_name
)
+
1
);
strcpy
(
newfilename
,
data_dir
);
strcat
(
newfilename
,
"/"
);
strcat
(
newfilename
,
prefix
+
sizeof
(
UNPACK_TREE
));
if
(
!
mkdir_p
(
newfilename
))
{
free
(
filename
);
free
(
newfilename
);
continue
;
}
strcat
(
newfilename
,
"/"
);
strcat
(
newfilename
,
dent
->
d_name
);
if
(
stat
(
newfilename
,
&
st
)
==
0
&&
st
.
st_size
==
size
)
{
free
(
filename
);
free
(
newfilename
);
continue
;
}
f
=
fopen
(
newfilename
,
"w"
);
if
(
f
==
NULL
)
{
LOGE
(
"extract_files: Could not open %s for writing: %s"
,
newfilename
,
strerror
(
errno
));
free
(
filename
);
free
(
newfilename
);
continue
;
}
if
(
fwrite
(
apkentry
,
size
,
1
,
f
)
!=
1
)
{
LOGE
(
"extract_files: Could not write %d bytes to %s: %s"
,
size
,
newfilename
,
strerror
(
errno
));
}
LOGI
(
"extract_files: Copied %s to %s: %d bytes"
,
filename
,
newfilename
,
size
);
fclose
(
f
);
free
(
filename
);
free
(
newfilename
);
}
}
lo_apk_closedir
(
tree
);
}
__attribute__
((
visibility
(
"default"
)))
__attribute__
((
visibility
(
"default"
)))
void
void
Java_org_libreoffice_android_Bootstrap_patch_libgnustl_shared
(
JNIEnv
*
env
,
Java_org_libreoffice_android_Bootstrap_patch_libgnustl_shared
(
JNIEnv
*
env
,
...
@@ -1352,6 +1468,8 @@ android_main(struct android_app* state)
...
@@ -1352,6 +1468,8 @@ android_main(struct android_app* state)
patch_libgnustl_shared
();
patch_libgnustl_shared
();
extract_files
(
UNPACK_TREE
);
lo_main
(
lo_main_argc
,
lo_main_argv
);
lo_main
(
lo_main_argc
,
lo_main_argv
);
exit
(
0
);
exit
(
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment