26 #if defined (HAVE_CONFIG_H)
46 static void append_to_shell_path (
const std::string& exec_path)
51 if (exec_path.empty ())
56 std::string shell_path = sys::env::getenv (
"PATH");
58 if (shell_path.empty ())
59 sys::env::putenv (
"PATH", exec_path);
68 if (shell_path.find (exec_path) == std::string::npos)
69 sys::env::putenv (
"PATH", shell_path + path_sep + exec_path);
86 append_to_shell_path (m_exec_path);
94 std::string old_val = set (m_exec_path, path);
96 append_to_shell_path (m_exec_path);
109 environment::init_editor ()
111 std::string retval =
"emacs";
113 std::string env_editor = sys::env::getenv (
"EDITOR");
115 if (! env_editor.empty ())
122 environment::init_exec_path ()
124 std::string
exec_path = sys::env::getenv (
"OCTAVE_EXEC_PATH");
141 environment::init_image_path ()
147 std::string env_path = sys::env::getenv (
"OCTAVE_IMAGE_PATH");
149 if (! env_path.empty ())
154 if (! gen_path.empty ())
160 DEFMETHOD (EDITOR, interp, args, nargout,
180 return env.editor (args, nargout);
195 DEFMETHOD (EXEC_PATH, interp, args, nargout,
217 return env.exec_path (args, nargout);
232 DEFMETHOD (IMAGE_PATH, interp, args, nargout,
249 return env.image_path (args, nargout);
264 OCTAVE_END_NAMESPACE(
octave)
static std::string path_sep_str()
std::string exec_path() const
std::string image_path() const
std::string editor() const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
std::string local_ver_arch_lib_dir()
std::string local_arch_lib_dir()
std::string local_api_arch_lib_dir()
std::string arch_lib_dir()
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
std::string genpath(const std::string &dir, const string_vector &skip="private")
octave_value set_internal_variable(bool &var, const octave_value_list &args, int nargout, const char *nm)