LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File sdcv-0.4.2-use-env-home.patch of Package sdcv (Project Education)

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));