summaryrefslogtreecommitdiff
path: root/misc/sdcv/patches/10_use-env-home.patch
diff options
context:
space:
mode:
Diffstat (limited to 'misc/sdcv/patches/10_use-env-home.patch')
-rw-r--r--misc/sdcv/patches/10_use-env-home.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/misc/sdcv/patches/10_use-env-home.patch b/misc/sdcv/patches/10_use-env-home.patch
new file mode 100644
index 0000000000..e912c68268
--- /dev/null
+++ b/misc/sdcv/patches/10_use-env-home.patch
@@ -0,0 +1,31 @@
+From: Michal Čihař <nijel@debian.org>
+Subject: Use environment variable HOME to get home directory. g_get_home_dir does ignore it.
+Index: sdcv-0.4.2/src/sdcv.cpp
+===================================================================
+--- sdcv-0.4.2.orig/src/sdcv.cpp 2008-10-03 09:15:26.000000000 +0200
++++ sdcv-0.4.2/src/sdcv.cpp 2008-10-03 09:16:25.000000000 +0200
+@@ -157,11 +157,14 @@
+ data_dir="/usr/share/stardict/dic";
+ }
+
++ const char *homedir = g_getenv ("HOME");
++ if (!homedir)
++ homedir = g_get_home_dir ();
+
+
+ strlist_t dicts_dir_list;
+
+- dicts_dir_list.push_back(std::string(g_get_home_dir())+G_DIR_SEPARATOR+
++ dicts_dir_list.push_back(std::string(homedir)+G_DIR_SEPARATOR+
+ ".stardict"+G_DIR_SEPARATOR+"dic");
+ dicts_dir_list.push_back(data_dir);
+
+@@ -186,7 +189,7 @@
+ }
+
+
+- string conf_dir = string(g_get_home_dir())+G_DIR_SEPARATOR+".stardict";
++ string conf_dir = string(homedir)+G_DIR_SEPARATOR+".stardict";
+ if (g_mkdir(conf_dir.c_str(), S_IRWXU)==-1 && errno!=EEXIST)
+ fprintf(stderr, _("g_mkdir failed: %s\n"), strerror(errno));
+