blob: e912c682680945a7cc2bf7e011bf0cf0ac7c5d33 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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));
|