termux-packages/packages/hunspell/hunspell.cxx.patch

56 lines
1.5 KiB
Diff

diff -u -r ../hunspell-1.3.3/src/tools/hunspell.cxx ./src/tools/hunspell.cxx
--- ../hunspell-1.3.3/src/tools/hunspell.cxx 2014-06-02 07:35:50.000000000 -0400
+++ ./src/tools/hunspell.cxx 2016-03-06 02:28:02.031833160 -0500
@@ -68,7 +68,7 @@
#include "odfparser.hxx"
#define LIBDIR \
- "/usr/share/hunspell:" \
+ "@TERMUX_PREFIX@/share/hunspell:" \
"/usr/share/myspell:" \
"/usr/share/myspell/dicts:" \
"/Library/Spelling"
@@ -92,7 +92,7 @@
"/usr/lib/openoffice.org2.0/share/dict/ooo"
#define HOME getenv("HOME")
#define DICBASENAME ".hunspell_"
-#define LOGFILE "/tmp/hunspell.log"
+#define LOGFILE "@TERMUX_PREFIX@/tmp/hunspell.log"
#define DIRSEPCH '/'
#define DIRSEP "/"
#define PATHSEP ":"
@@ -1423,7 +1423,13 @@
}
}
+#ifdef __ANDROID__
+ char tmpfile_template[] = "@TERMUX_PREFIX@/tmp/hunspell.XXXXXX";
+ int tmpfile_fd = mkstemp(tmpfile_template);
+ FILE *tempfile = fdopen(tmpfile_fd, "w+");
+#else
FILE *tempfile = tmpfile();
+#endif
if (!tempfile)
{
@@ -1443,6 +1449,9 @@
clear();
refresh();
fclose(tempfile); //automatically deleted when closed
+#ifdef __ANDROID__
+ unlink(tmpfile_template);
+#endif
if (is_zipped_odf(parser, extension)) {
sprintf(buf, "rm %s; rmdir %s", filename, odftempdir);
if (system(buf) != 0)
@@ -1493,6 +1502,9 @@
delete parser;
fclose(tempfile); //automatically deleted when closed
+#ifdef __ANDROID__
+ unlink(tmpfile_template);
+#endif
}
#endif