mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Use g_getenv instead of getenv.
getenv returns the pure bytes, whereas g_getenv converts the value to the GLib filename encoding, i.e. UTF-8 on Windows. Also use TRUE instead of 1 as overwrite argument to g_setenv. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15412 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
9c72ea9327
commit
f1f0f8537a
@ -388,16 +388,17 @@ gnc_timegm (struct tm *tm)
|
||||
time_t result;
|
||||
char *old_tz;
|
||||
|
||||
old_tz = getenv ("TZ");
|
||||
old_tz = g_strdup(g_getenv ("TZ"));
|
||||
/* FIXME: there's no way to report this error to the caller. */
|
||||
if (!g_setenv("TZ", "UTC", 1))
|
||||
if (!g_setenv("TZ", "UTC", TRUE))
|
||||
PERR ("couldn't switch the TZ.");
|
||||
result = mktime (tm);
|
||||
if(old_tz)
|
||||
{
|
||||
/* FIXME: there's no way to report this error to the caller. */
|
||||
if (!g_setenv("TZ", old_tz, 1))
|
||||
if (!g_setenv("TZ", old_tz, TRUE))
|
||||
PERR ("couldn't switch the TZ back.");
|
||||
g_free(old_tz);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -66,7 +66,7 @@ test_load_file(QofBook *book, const char *filename)
|
||||
static void
|
||||
guile_main (void *closure, int argc, char **argv)
|
||||
{
|
||||
const char *location = getenv("GNC_ACCOUNT_PATH");
|
||||
const char *location = g_getenv("GNC_ACCOUNT_PATH");
|
||||
GSList *list = NULL;
|
||||
GDir *ea_dir;
|
||||
QofBook *book;
|
||||
|
@ -85,7 +85,7 @@ test_load_file(const char *filename)
|
||||
|
||||
remove_locks(filename);
|
||||
|
||||
ignore_lock = (safe_strcmp(getenv("SRCDIR"), ".") != 0);
|
||||
ignore_lock = (safe_strcmp(g_getenv("SRCDIR"), ".") != 0);
|
||||
qof_session_begin(session, filename, ignore_lock, FALSE);
|
||||
|
||||
qof_session_load(session, NULL);
|
||||
@ -106,7 +106,7 @@ test_load_file(const char *filename)
|
||||
int
|
||||
main (int argc, char ** argv)
|
||||
{
|
||||
const char *location = getenv("GNC_TEST_FILES");
|
||||
const char *location = g_getenv("GNC_TEST_FILES");
|
||||
GDir *xml2_dir;
|
||||
|
||||
g_type_init();
|
||||
|
@ -93,8 +93,8 @@ test_file(const char *filename)
|
||||
return g_strdup_printf("qof_session_load errorid %d", err);
|
||||
}
|
||||
|
||||
if (!g_setenv("LANG", possible_envs[i], 1))
|
||||
return g_strdup_printf("setenv for LANG");
|
||||
if (!g_setenv("LANG", possible_envs[i], TRUE))
|
||||
return g_strdup("setenv for LANG");
|
||||
|
||||
new_session = qof_session_new();
|
||||
|
||||
@ -165,7 +165,7 @@ main(int argc, char **argv)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!g_setenv("LANG", base_env, 1))
|
||||
if (!g_setenv("LANG", base_env, TRUE))
|
||||
{
|
||||
failure_args("setenv", __FILE__, __LINE__,
|
||||
"setenv of LANG failed");
|
||||
|
@ -13,7 +13,7 @@
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
const char *directory = getenv("GNC_TEST_FILES");
|
||||
const char *directory = g_getenv("GNC_TEST_FILES");
|
||||
char *filename;
|
||||
|
||||
if (!directory)
|
||||
|
@ -96,14 +96,14 @@ static char *help_path = GNC_HELPDIR;
|
||||
static void
|
||||
envt_override()
|
||||
{
|
||||
char *path;
|
||||
const char *path;
|
||||
|
||||
if ((path = getenv("GNC_CONFIG_PATH")))
|
||||
config_path = path;
|
||||
if ((path = getenv("GNC_SHARE_PATH")))
|
||||
share_path = path;
|
||||
if ((path = getenv("GNC_DOC_PATH")))
|
||||
help_path = path;
|
||||
if ((path = g_getenv("GNC_CONFIG_PATH")))
|
||||
config_path = g_strdup(path);
|
||||
if ((path = g_getenv("GNC_SHARE_PATH")))
|
||||
share_path = g_strdup(path);
|
||||
if ((path = g_getenv("GNC_DOC_PATH")))
|
||||
help_path = g_strdup(path);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -46,11 +46,11 @@ static GNCModuleInfo * gnc_module_get_info(const char * lib_path);
|
||||
static GList *
|
||||
gnc_module_system_search_dirs(void)
|
||||
{
|
||||
char * spath = getenv("GNC_MODULE_PATH");
|
||||
const char *spath = g_getenv("GNC_MODULE_PATH");
|
||||
GList * list = NULL;
|
||||
GString * token = g_string_new(NULL);
|
||||
int escchar = 0;
|
||||
char * cpos;
|
||||
const char *cpos;
|
||||
|
||||
if(!spath)
|
||||
{
|
||||
@ -127,13 +127,9 @@ gnc_module_system_setup_load_path(void)
|
||||
|
||||
if(dirs)
|
||||
{
|
||||
char *envt = getenv("LD_LIBRARY_PATH");
|
||||
char *envt = g_strdup(g_getenv("LD_LIBRARY_PATH"));
|
||||
|
||||
if(envt)
|
||||
{
|
||||
envt = g_strdup(envt);
|
||||
}
|
||||
else
|
||||
if(!envt)
|
||||
{
|
||||
envt = g_strdup("");
|
||||
}
|
||||
@ -147,7 +143,7 @@ gnc_module_system_setup_load_path(void)
|
||||
}
|
||||
g_list_free(dirs);
|
||||
|
||||
if (!g_setenv("LD_LIBRARY_PATH", envt, 1))
|
||||
if (!g_setenv("LD_LIBRARY_PATH", envt, TRUE))
|
||||
{
|
||||
g_warning ("gnc-module failed to set LD_LIBRARY_PATH");
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ test_qif(void)
|
||||
{
|
||||
QifContext ctx, file;
|
||||
char *filename;
|
||||
const char *location = getenv("GNC_TEST_FILES");
|
||||
const char *location = g_getenv("GNC_TEST_FILES");
|
||||
int i;
|
||||
|
||||
ctx = qif_context_new();
|
||||
|
Loading…
Reference in New Issue
Block a user