2006-11-01 22:56:08 +00:00
|
|
|
diff -riwBu -Xex aspell-setter-sep06\common\config.cpp aspell-setter-sep06-modified\common\config.cpp
|
|
|
|
--- aspell-setter-sep06\common\config.cpp Mon Dec 12 17:41:06 2005
|
|
|
|
+++ aspell-setter-sep06-modified\common\config.cpp Sun Oct 22 13:03:46 2006
|
|
|
|
@@ -78,6 +78,10 @@
|
2006-09-19 23:10:58 +00:00
|
|
|
|
|
|
|
namespace aspell {
|
|
|
|
|
|
|
|
+#ifdef WIN32PORT
|
2006-11-01 22:56:08 +00:00
|
|
|
+ String GetWindowsDir(String registry_name, String default_directory);
|
2006-09-19 23:10:58 +00:00
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
const char * const keyinfo_type_name[4] = {
|
|
|
|
N_("string"), N_("integer"), N_("boolean"), N_("list")
|
|
|
|
};
|
2006-11-01 22:56:08 +00:00
|
|
|
@@ -642,20 +646,19 @@
|
2006-09-19 23:10:58 +00:00
|
|
|
|
|
|
|
} else if (strcmp(i, "home-dir") == 0) {
|
|
|
|
|
|
|
|
- //get the personal folder (e.g. "c:\My Documents")
|
2006-11-01 22:56:08 +00:00
|
|
|
- char * dir = new char[MAX_PATH];
|
|
|
|
- LPITEMIDLIST items = 0;
|
|
|
|
- HRESULT hand = SHGetSpecialFolderLocation(0, CSIDL_PERSONAL, &items);
|
|
|
|
- if ((NOERROR == hand) && items) {
|
|
|
|
- if (SHGetPathFromIDList(items, dir)) {
|
|
|
|
- for (char *ptr = dir; *ptr; ++ptr)
|
|
|
|
- if ('\\' == *ptr)
|
|
|
|
- *ptr = '/';
|
|
|
|
- final_str = dir;
|
|
|
|
- }
|
|
|
|
- CoTaskMemFree(items);
|
|
|
|
- }
|
|
|
|
- delete [] dir;
|
|
|
|
+ final_str = GetWindowsDir("Base Path", "");
|
2006-09-19 23:10:58 +00:00
|
|
|
+
|
2006-11-01 22:56:08 +00:00
|
|
|
+ } else if (strcmp(i, "dict-dir") == 0) {
|
2006-09-19 23:10:58 +00:00
|
|
|
+
|
2006-11-01 22:56:08 +00:00
|
|
|
+ final_str = GetWindowsDir("Dictionary Path", "Dictionaries");
|
|
|
|
+
|
|
|
|
+ } else if (strcmp(i, "data-dir") == 0) {
|
|
|
|
+
|
|
|
|
+ final_str = GetWindowsDir("Data Path", "Data");
|
|
|
|
+
|
|
|
|
+ } else if (strcmp(i, "personal-dir") == 0) {
|
|
|
|
+
|
|
|
|
+ final_str = GetWindowsDir("Personal Path", "Personal");
|
2006-09-19 23:10:58 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|
2006-11-01 22:56:08 +00:00
|
|
|
@@ -1394,20 +1397,6 @@
|
2006-09-19 23:10:58 +00:00
|
|
|
return no_err;
|
|
|
|
}
|
|
|
|
|
|
|
|
-#if defined(WIN32_USE_PERSONAL_DIR)
|
|
|
|
-# define HOME_DIR "!home-dir"
|
|
|
|
-# define PERSONAL "<lang>.pws"
|
|
|
|
-# define REPL "<lang>.prepl"
|
|
|
|
-#elif defined(ENABLE_WIN32_RELOCATABLE)
|
|
|
|
-# define HOME_DIR "<prefix>"
|
|
|
|
-# define PERSONAL "<lang>.pws"
|
|
|
|
-# define REPL "<lang>.prepl"
|
|
|
|
-#else
|
|
|
|
-# define HOME_DIR "<$HOME|./>"
|
|
|
|
-# define PERSONAL ".aspell.<lang>.pws"
|
|
|
|
-# define REPL ".aspell.<lang>.prepl"
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
static const KeyInfo config_keys[] = {
|
|
|
|
// the description should be under 50 chars
|
|
|
|
{"actual-dict-dir", KeyInfoString, "<dict-dir^master>", 0}
|
2006-11-01 22:56:08 +00:00
|
|
|
@@ -1484,7 +1473,7 @@
|
2006-09-19 23:10:58 +00:00
|
|
|
, {"per-conf-path", KeyInfoString, "<home-dir/per-conf>", 0}
|
|
|
|
, {"personal", KeyInfoString, PERSONAL,
|
|
|
|
N_("personal dictionary file name")}
|
|
|
|
- , {"personal-path", KeyInfoString, "<home-dir/personal>", 0}
|
|
|
|
+ , {"personal-path", KeyInfoString, PERSONAL_DIR, 0}
|
|
|
|
, {"prefix", KeyInfoString, PREFIX,
|
|
|
|
N_("prefix directory")}
|
|
|
|
, {"repl", KeyInfoString, REPL,
|
2006-11-01 22:56:08 +00:00
|
|
|
@@ -1525,10 +1514,8 @@
|
2006-09-19 23:10:58 +00:00
|
|
|
, {"warn", KeyInfoBool, "true",
|
|
|
|
N_("enable warnings")}
|
|
|
|
#ifdef WIN32PORT
|
|
|
|
- , {"dict-subdir", KeyInfoString, "dicts",
|
2006-11-01 22:56:08 +00:00
|
|
|
- N_("sub directory for dictionaries")}
|
|
|
|
- , {"data-subdir", KeyInfoString, "data",
|
|
|
|
- N_("sub directory for other data")}
|
|
|
|
+ , {"personal-dir", KeyInfoString, PERSONAL_DIR,
|
|
|
|
+ N_("directory for personal dictionaries")}
|
2006-09-19 23:10:58 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//
|
2006-11-01 22:56:08 +00:00
|
|
|
@@ -1587,5 +1574,88 @@
|
2006-09-19 23:10:58 +00:00
|
|
|
config_impl_keys_begin,
|
|
|
|
config_impl_keys_end);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+#ifdef WIN32PORT
|
|
|
|
+
|
|
|
|
+ String ReadRegString(HKEY hive, String key, String name)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ // Reads a string from the Windows registry (used to get paths)
|
|
|
|
+
|
|
|
|
+ HKEY hKey;
|
|
|
|
+ unsigned long lType;
|
|
|
|
+ DWORD dwSize;
|
|
|
|
+ unsigned char* szValue = NULL;
|
|
|
|
+
|
|
|
|
+ if (::RegOpenKeyEx(hive, key.c_str(), 0, KEY_READ, &hKey) == ERROR_SUCCESS)
|
|
|
|
+ {
|
|
|
|
+ if(::RegQueryValueEx(hKey, name.c_str(), NULL, &lType, NULL, &dwSize) == ERROR_SUCCESS)
|
|
|
|
+ {
|
|
|
|
+ szValue = new unsigned char[dwSize + 1];
|
|
|
|
+ ::RegQueryValueEx(hKey, name.c_str(), NULL, &lType, szValue, &dwSize);
|
|
|
|
+ String RegistryReturn((char*)szValue);
|
|
|
|
+ delete[] szValue;
|
|
|
|
+ return RegistryReturn;
|
|
|
|
+ } else {
|
|
|
|
+ return "";
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ return "";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ HKEY GetRegHive()
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ // Check whether Aspell is installed for the current user or for all users
|
|
|
|
+
|
|
|
|
+ String value;
|
|
|
|
+
|
2006-11-01 22:56:08 +00:00
|
|
|
+ if (ReadRegString(HKEY_CURRENT_USER, "Software\\Aspell", "Base Path").empty())
|
2006-09-19 23:10:58 +00:00
|
|
|
+ {
|
|
|
|
+ return HKEY_LOCAL_MACHINE;
|
2006-11-01 22:56:08 +00:00
|
|
|
+ } else {
|
|
|
|
+ return HKEY_CURRENT_USER;
|
2006-09-19 23:10:58 +00:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
2006-11-01 22:56:08 +00:00
|
|
|
+ String GetWindowsDir(String registry_name, String default_dir)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ String final_dir;
|
|
|
|
+
|
|
|
|
+ // Get directory from registry
|
|
|
|
+ HKEY hive;
|
|
|
|
+ hive = GetRegHive();
|
|
|
|
+ final_dir = ReadRegString(hive, "Software\\Aspell", registry_name);
|
|
|
|
+
|
|
|
|
+ // Default location in "Documents and Settings"
|
|
|
|
+ if (final_dir.empty()) {
|
|
|
|
+
|
|
|
|
+ char * dir = new char[MAX_PATH];
|
|
|
|
+ LPITEMIDLIST items = 0;
|
|
|
|
+ HRESULT hand = SHGetSpecialFolderLocation(0, CSIDL_APPDATA, &items);
|
|
|
|
+
|
|
|
|
+ if ((NOERROR == hand) && items) {
|
|
|
|
+ if (SHGetPathFromIDList(items, dir)) {
|
|
|
|
+ for (char *ptr = dir; *ptr; ++ptr)
|
|
|
|
+ if ('\\' == *ptr)
|
|
|
|
+ *ptr = '/';
|
|
|
|
+ final_dir = dir;
|
|
|
|
+ final_dir.append("/Aspell/");
|
|
|
|
+ final_dir.append(default_dir.c_str());
|
|
|
|
+ }
|
|
|
|
+ CoTaskMemFree(items);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return final_dir;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
2006-09-19 23:10:58 +00:00
|
|
|
+#endif
|
|
|
|
|
|
|
|
}
|
2006-11-01 22:56:08 +00:00
|
|
|
diff -riwBu -Xex aspell-setter-sep06\common\vector.hpp aspell-setter-sep06-modified\common\vector.hpp
|
|
|
|
--- aspell-setter-sep06\common\vector.hpp Thu Oct 13 08:42:54 2005
|
|
|
|
+++ aspell-setter-sep06-modified\common\vector.hpp Sun Sep 17 18:50:45 2006
|
2006-09-19 23:10:58 +00:00
|
|
|
@@ -50,10 +50,10 @@
|
|
|
|
T * data_end() {return &*this->end();}
|
|
|
|
|
|
|
|
T * pbegin() {return &*this->begin();}
|
|
|
|
- T * pend() {return &*this->end();}
|
|
|
|
+ T * pend() {return &this->back()+1;}
|
|
|
|
|
|
|
|
const T * pbegin() const {return &*this->begin();}
|
|
|
|
- const T * pend() const {return &*this->end();}
|
|
|
|
+ const T * pend() const {return &this->back()+1;}
|
|
|
|
|
|
|
|
template <typename U>
|
|
|
|
U * datap() {
|
2006-11-01 22:56:08 +00:00
|
|
|
diff -riwBu -Xex aspell-setter-sep06\win32\dirs.h aspell-setter-sep06-modified\win32\dirs.h
|
|
|
|
--- aspell-setter-sep06\win32\dirs.h Thu Oct 13 12:29:34 2005
|
|
|
|
+++ aspell-setter-sep06-modified\win32\dirs.h Sun Oct 22 12:55:10 2006
|
|
|
|
@@ -1,16 +1,27 @@
|
2006-09-19 23:10:58 +00:00
|
|
|
#ifndef dirs_h
|
|
|
|
#define dirs_h
|
|
|
|
|
|
|
|
-#ifdef WIN32_USE_EXECUTABLE_DIR
|
|
|
|
-# define DATA_DIR "<prefix/data-subdir>"
|
|
|
|
-# define CONF_DIR "<prefix>"
|
|
|
|
-# define DICT_DIR "<prefix/dict-subdir>"
|
2006-11-01 22:56:08 +00:00
|
|
|
+# define DATA_DIR "!data-dir"
|
|
|
|
+# define DICT_DIR "!dict-dir"
|
|
|
|
+# define PERSONAL_DIR "!personal-dir"
|
2006-09-19 23:10:58 +00:00
|
|
|
+
|
|
|
|
+#if defined(WIN32_USE_EXECUTABLE_DIR)
|
|
|
|
+# define HOME_DIR "<prefix>"
|
2006-11-01 22:56:08 +00:00
|
|
|
+# define PERSONAL "<personal-dir>/<lang>.pws"
|
|
|
|
+# define REPL "<personal-dir>/<lang>.prepl"
|
2006-09-19 23:10:58 +00:00
|
|
|
# define PREFIX "!prefix"
|
|
|
|
+#elif defined(WIN32_USE_PERSONAL_DIR)
|
|
|
|
+# define HOME_DIR "!home-dir"
|
2006-11-01 22:56:08 +00:00
|
|
|
+# define PERSONAL "<personal-dir>/<lang>.pws"
|
|
|
|
+# define REPL "<personal-dir>/<lang>.prepl"
|
2006-09-19 23:10:58 +00:00
|
|
|
+# define PREFIX "<home-dir>"
|
|
|
|
#else
|
|
|
|
-# define DATA_DIR "aspell-win32/data"
|
|
|
|
-# define CONF_DIR "aspell-win32"
|
|
|
|
-# define DICT_DIR "dicts"
|
|
|
|
-# define PREFIX "aspell-win32"
|
|
|
|
+# define HOME_DIR "<$HOME|./>"
|
2006-11-01 22:56:08 +00:00
|
|
|
+# define PERSONAL "<personal-dir>/.aspell.<lang>.pws"
|
|
|
|
+# define REPL "<personal-dir>/.aspell.<lang>.prepl"
|
2006-09-19 23:10:58 +00:00
|
|
|
+# define PREFIX "<home-dir>"
|
|
|
|
#endif
|
2006-11-01 22:56:08 +00:00
|
|
|
+
|
|
|
|
+#define CONF_DIR HOME_DIR
|
2006-09-19 23:10:58 +00:00
|
|
|
|
|
|
|
#endif
|
2006-11-01 22:56:08 +00:00
|
|
|
diff -riwBu -Xex aspell-setter-sep06\win32\settings.h aspell-setter-sep06-modified\win32\settings.h
|
|
|
|
--- aspell-setter-sep06\win32\settings.h Wed Sep 06 09:51:16 2006
|
|
|
|
+++ aspell-setter-sep06-modified\win32\settings.h Sun Sep 17 17:55:23 2006
|
2006-09-19 23:10:58 +00:00
|
|
|
@@ -9,9 +9,6 @@
|
|
|
|
/* Defined if curses like POSIX Functions should be used */
|
|
|
|
#undef CURSES_ONLY
|
|
|
|
|
|
|
|
-/* Defined if win32 relocation should be used */
|
|
|
|
-#define ENABLE_WIN32_RELOCATABLE 1
|
|
|
|
-
|
|
|
|
/* Define to 1 if you have the <dlfcn.h> header file. */
|
|
|
|
#undef HAVE_DLFCN_H
|
|
|
|
|