*** pgadmin/include/frm/frmMain.h.orig 2010-06-06 16:57:41.000000000 +0900 --- pgadmin/include/frm/frmMain.h 2010-06-06 16:59:33.000000000 +0900 *************** *** 59,64 **** --- 59,65 ---- bool database; wxArrayString applies_to; bool set_password; + wxArrayString set_env; } PluginUtility; *************** *** 286,292 **** wxString title, command, description; bool database, set_password; ! wxArrayString applies_to, server_types; }; class pluginButtonMenuFactory : public actionFactory --- 287,293 ---- wxString title, command, description; bool database, set_password; ! wxArrayString applies_to, server_types, set_env; }; class pluginButtonMenuFactory : public actionFactory *** pgadmin/frm/plugins.cpp.orig 2010-06-06 17:00:36.000000000 +0900 --- pgadmin/frm/plugins.cpp 2010-06-06 17:35:17.000000000 +0900 *************** *** 138,143 **** --- 138,154 ---- else util->set_password = false; } + // Environment + if (token.Lower().StartsWith(wxT("environment="))) + { + util->set_env.Clear(); + + // This is a comma delimited list of values going into an array. + wxStringTokenizer valueTkz(token.AfterFirst('='), wxT(",")); + + while(valueTkz.HasMoreTokens()) + util->set_env.Add(valueTkz.GetNextToken()); + } } // Add the last app if required. *************** *** 202,207 **** --- 213,219 ---- util->database = false; util->applies_to.Clear(); util->set_password = false; + util->set_env.Clear(); } // The actionFactory for the plugin utilities *************** *** 214,219 **** --- 226,232 ---- database = util->database; applies_to = util->applies_to; set_password = util->set_password; + set_env = util->set_env; menu->Append(id, title, description); } *************** *** 222,228 **** wxWindow *pluginUtilityFactory::StartDialog(frmMain *form, pgObject *obj) { wxString execCmd = command; ! wxArrayString environment; // Remember this as the last plugin used form->SetLastPluginUtility(this); --- 235,241 ---- wxWindow *pluginUtilityFactory::StartDialog(frmMain *form, pgObject *obj) { wxString execCmd = command; ! wxArrayString environment = set_env; // Remember this as the last plugin used form->SetLastPluginUtility(this); *************** *** 300,305 **** --- 313,325 ---- execCmd.Replace(wxT("$$EDBBINDIR"), settings->GetEnterprisedbPath()); execCmd.Replace(wxT("$$SLONYBINDIR"), settings->GetSlonyPath()); + // set Environment variable. + for (size_t i=0 ; i < environment.GetCount() ; i++) + { + wxString str=environment.Item(i); + wxSetEnv(str.BeforeFirst('='), str.AfterFirst('=')); + } + // Let's go!! if (wxExecute(execCmd) == 0) wxLogError(_("Failed to execute plugin %s (%s)"), title.c_str(), command.c_str()); *** pgadmin/plugins.ini.orig 2010-06-06 17:35:41.000000000 +0900 --- pgadmin/plugins.ini 2010-06-06 17:38:23.000000000 +0900 *************** *** 79,84 **** --- 79,88 ---- ; application. If the same option is specified more than once for an utility, ; the last one will be used. The Title and Command for each utility must be ; specified. + ; + ; Environment - Set to variable=value[,variable=value] + ; + ; * The variable set up at the time of execution is specified. ; ; PSQL (Unix):