blob: 060a018602039cab7bd22810acaaac5b04f8bd32 [file] [log] [blame]
--- aspell-0.60.7-20110707/common/info.cpp.orig 2004-11-10 06:18:45.000000000 +0000
+++ aspell-0.60.7-20110707/common/info.cpp 2014-03-20 14:46:13.395537900 +0000
@@ -39,6 +39,19 @@
#include "gettext.h"
+#ifdef ENABLE_W32_PREFIX
+extern "C" {
+static HINSTANCE dll_hinstance;
+
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+ if (fdwReason == DLL_PROCESS_ATTACH)
+ dll_hinstance = hinstDLL;
+ return TRUE;
+}
+}
+#endif
+
namespace acommon {
class Dir {
@@ -777,4 +790,60 @@
return data;
}
+#ifdef ENABLE_W32_PREFIX
+
+const char *
+get_w32_prefix ()
+{
+
+ static char *wprefix = NULL;
+
+/*
+ Entry * next;
+ String key;
+ String value;
+ String file;
+*/
+ if (wprefix == NULL)
+ {
+ DWORD bsize = MAX_PATH;
+ DWORD l = bsize;
+ char *bslash, *slash;
+ char *buf = (char *) malloc (bsize);
+ while (l == bsize)
+ {
+ l = GetModuleFileNameA (dll_hinstance, buf, bsize);
+ if (l == 0)
+ {
+ DebugBreak ();
+ abort ();
+ }
+ if (l == bsize)
+ {
+ buf = (char *) realloc ((void *) buf, bsize * 2);
+ bsize *= 2;
+ l = bsize;
+ }
+ }
+ bslash = strrchr (buf, '\\');
+ slash = strrchr (buf, '/');
+ if (bslash > slash)
+ slash = bslash;
+ slash[0] = '\0';
+ l = strlen (buf);
+ if (l > 3 && strcmp (&buf[l - 3], "bin") == 0)
+ {
+ bslash = strrchr (buf, '\\');
+ slash = strrchr (buf, '/');
+ if (bslash > slash)
+ slash = bslash;
+ slash[0] = '\0';
+ }
+ wprefix = buf;
+
+ }
+ return wprefix;
+}
+#endif
+
}
--- aspell-0.60.7-20110707/common/info.hpp.orig 2004-05-30 10:49:17.000000000 +0000
+++ aspell-0.60.7-20110707/common/info.hpp 2014-03-20 14:45:24.476325900 +0000
@@ -140,8 +140,7 @@
};
-
-
+ const char * get_w32_prefix ();
}
#endif /* ASPELL_INFO__HPP */
--- aspell-0.60.7-20110707/common/config.cpp.orig 2014-03-20 13:52:58.851882300 +0000
+++ aspell-0.60.7-20110707/common/config.cpp 2014-03-20 14:17:49.116621900 +0000
@@ -298,6 +303,14 @@
const Entry * res = 0;
const Entry * cur = first_;
+#ifdef ENABLE_W32_PREFIX
+ if (key == "prefix")
+ {
+ Entry *e = new Config::Entry();
+ e->value = get_w32_prefix ();
+ return e;
+ }
+#endif
while (cur) {
if (cur->key == key && cur->action != NoOp) res = cur;
cur = cur->next;
--- aspell-0.60.7-20110707/common/config.cpp.orig 2014-03-20 15:11:29.935614000 +0000
+++ aspell-0.60.7-20110707/common/config.cpp 2014-03-20 15:22:47.619168900 +0000
@@ -22,6 +22,8 @@
# include <langinfo.h>
#endif
+#include "info.hpp"
+#include <windows.h>
#include "cache.hpp"
#include "asc_ctype.hpp"
#include "config.hpp"