From 502e84510555e313809de4fc120c15a3267dd482 Mon Sep 17 00:00:00 2001 From: Evgeniy Dushistov Date: Sun, 1 Aug 2010 21:00:33 +0000 Subject: [PATCH] Import Volkov Peter ( volkov_peter )'s patch: sdcv uses g_get_home_dir function to find home directory. That function uses passwd entry and this in turn breaks expectations of users and automatic tests inside sandbox where access behind some directory is not allowed (and thus tests are not allowed to write into /root/.stardict/dic...) The patch in attachment fixes this basically by using code from gnome manual: http://library.gnome.org/devel/glib/stable/glib-Miscellaneous-Utility-Functions.html#g-get-home-dir const char *homedir = g_getenv ("HOME"); if (!homedir) homedir = g_get_home_dir (); --- src/sdcv.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sdcv.cpp b/src/sdcv.cpp index 50fc22e..7fa8761 100644 --- a/src/sdcv.cpp +++ b/src/sdcv.cpp @@ -157,7 +157,11 @@ int main(int argc, char *argv[]) strlist_t dicts_dir_list; - dicts_dir_list.push_back(std::string(g_get_home_dir())+G_DIR_SEPARATOR+ + const char *homedir = g_getenv ("HOME"); + if (!homedir) + homedir = g_get_home_dir (); + + dicts_dir_list.push_back(std::string(homedir)+G_DIR_SEPARATOR+ ".stardict"+G_DIR_SEPARATOR+"dic"); dicts_dir_list.push_back(data_dir);