49 #include <sys/types.h>
64 : follow_symbolic_links (true), verbatim_pwd (true),
65 current_directory (), prog_name (), prog_invocation_name (),
66 user_name (), host_name ()
94 (*current_liboctave_error_handler)
95 (
"unable to create current working directory object!");
207 std::string display =
getenv (
"DISPLAY");
209 return ! display.empty ();
233 ? prog_invocation_name : prog_invocation_name.substr (pos+1);
246 size_t len = home_dir.length ();
248 if (len > 1 && home_dir == name.substr (0, len)
252 retval.append (name.substr (len));
263 size_t len = s.length ();
271 #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM)
272 if ((len == 2 && isalpha (s[0]) && s[1] ==
':')
273 || (len > 2 && isalpha (s[0]) && s[1] ==
':'
284 size_t len = s.length ();
289 if (len == 1 && s[0] ==
'.')
295 if (len == 2 && s[0] ==
'.' && s[1] ==
'.')
316 if (pos == std::string::npos)
319 return s.substr (pos+1);
327 const std::string& dot_path)
const
332 std::string current_dir = dot_path;
334 if (current_dir.empty ())
337 size_t pos = current_dir.length () - 1;
345 size_t slen = s.length ();
376 if (tmp == std::string::npos)
378 current_dir.append (s, i, tmp-i);
383 current_dir.append (s, i, tmp-i+1);
413 #if defined (__MINGW32__) || defined (_MSC_VER)
417 std::string drv =
do_getenv (
"HOMEDRIVE");
455 int status = gnulib::gethostname (hostname, 1023);
457 host_name = (status < 0) ?
"unknown" : hostname;
466 char *value =
::getenv (name.c_str ());
468 return value ? value :
"";
493 size_t len = tmp.length ();
521 size_t i = path.length () - 1;
540 (*current_liboctave_error_handler) (
"%s", gnulib::strerror (err_num));
546 (*current_liboctave_error_handler) (
"%s", s.c_str ());