Add application directory to PATH on startup, on win32

master
Yevgen Muntyan 2006-11-26 23:20:37 -06:00
parent 0f763a8d58
commit 7568b6e101
2 changed files with 56 additions and 0 deletions

View File

@ -547,6 +547,32 @@ check_args (int opt_remain)
}
static void
push_appdir_to_path (void)
{
#ifdef __WIN32__
char *appdir;
const char *path;
char *new_path;
appdir = moo_get_app_dir ();
g_return_if_fail (appdir != NULL);
path = g_getenv ("Path");
if (path)
new_path = g_strdup_printf ("%s;%s", appdir, path);
else
new_path = g_strdup (appdir);
g_setenv ("Path", new_path, TRUE);
g_free (new_path);
g_free (appdir);
#endif
}
int
main (int argc, char *argv[])
{
@ -586,6 +612,8 @@ main (int argc, char *argv[])
moo_set_log_func_window (TRUE);
}
push_appdir_to_path ();
if (_medit_opt_mode)
{
if (!strcmp (_medit_arg_mode, "simple"))

View File

@ -214,6 +214,32 @@ check_args (int opt_remain)
}
static void
push_appdir_to_path (void)
{
#ifdef __WIN32__
char *appdir;
const char *path;
char *new_path;
appdir = moo_get_app_dir ();
g_return_if_fail (appdir != NULL);
path = g_getenv ("Path");
if (path)
new_path = g_strdup_printf ("%s;%s", appdir, path);
else
new_path = g_strdup (appdir);
g_setenv ("Path", new_path, TRUE);
g_free (new_path);
g_free (appdir);
#endif
}
int
main (int argc, char *argv[])
{
@ -253,6 +279,8 @@ main (int argc, char *argv[])
moo_set_log_func_window (TRUE);
}
push_appdir_to_path ();
if (_medit_opt_mode)
{
if (!strcmp (_medit_arg_mode, "simple"))