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!");
199 #if defined (__MINGW32__) || defined (_MSC_VER)
206 #if defined (P_tmpdir)
213 if (tempd.empty () || tempd ==
"\\")
216 #else // Unix-like OS
220 #if defined (P_tmpdir)
253 std::string display =
getenv (
"DISPLAY");
255 return ! display.empty ();
279 ? prog_invocation_name : prog_invocation_name.substr (pos+1);
292 size_t len = home_dir.length ();
294 if (len > 1 && home_dir == name.substr (0, len)
298 retval.append (name.substr (len));
309 size_t len = s.length ();
317 #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM)
318 if ((len == 2 && isalpha (s[0]) && s[1] ==
':')
319 || (len > 2 && isalpha (s[0]) && s[1] ==
':'
330 size_t len = s.length ();
335 if (len == 1 && s[0] ==
'.')
341 if (len == 2 && s[0] ==
'.' && s[1] ==
'.')
362 if (pos == std::string::npos)
365 return s.substr (pos+1);
373 const std::string& dot_path)
const
378 std::string current_dir = dot_path;
380 if (current_dir.empty ())
383 size_t pos = current_dir.length () - 1;
391 size_t slen = s.length ();
422 if (tmp == std::string::npos)
424 current_dir.append (s, i, tmp-i);
429 current_dir.append (s, i, tmp-i+1);
459 #if defined (__MINGW32__) || defined (_MSC_VER)
463 std::string drv =
do_getenv (
"HOMEDRIVE");
501 int status = gnulib::gethostname (hostname, 1023);
503 host_name = (status < 0) ?
"unknown" : hostname;
512 char *value =
::getenv (name.c_str ());
514 return value ? value :
"";
539 size_t len = tmp.length ();
567 size_t i = path.length () - 1;
586 (*current_liboctave_error_handler) (
"%s", gnulib::strerror (err_num));
592 (*current_liboctave_error_handler) (
"%s", s.c_str ());
static uid_t getuid(void)
void octave_putenv(const std::string &name, const std::string &value)
static std::string get_program_name(void)
bool do_chdir(const std::string &newdir)
static void putenv(const std::string &name, const std::string &value)
void do_set_program_name(const std::string &s) const
bool do_rooted_relative_pathname(const std::string &s) const
int octave_chdir(const std::string &path_arg)
static bool instance_ok(void)
static void cleanup_instance(void)
std::string prog_invocation_name
bool do_absolute_pathname(const std::string &s) const
static void set_program_name(const std::string &s)
std::string do_base_pathname(const std::string &s) const
std::string dir(void) const
static std::string get_program_invocation_name(void)
static std::string get_current_directory(void)
static bool chdir(const std::string &newdir)
static std::string make_absolute(const std::string &s, const std::string &dot_path=get_current_directory())
std::string do_get_temp_directory(void) const
static std::string getenv(const std::string &name)
static bool absolute_pathname(const std::string &s)
static bool rooted_relative_pathname(const std::string &s)
std::string do_getenv(const std::string &name) const
std::string do_polite_directory_format(const std::string &name) const
static std::string polite_directory_format(const std::string &name)
static std::string dir_sep_chars(void)
static std::string base_pathname(const std::string &s)
std::string name(void) const
bool follow_symbolic_links
void pathname_backup(std::string &path, int n) const
std::string do_get_home_directory(void) const
std::string do_getcwd(void) const
static std::string get_user_name(void)
static bool is_dir_sep(char c)
std::string do_get_host_name(void) const
static octave_passwd getpwuid(uid_t uid)
static bool have_x11_display(void)
static std::string dir_sep_str(void)
std::string do_get_user_name(void) const
std::string do_make_absolute(const std::string &s, const std::string &dot_path) const
std::string current_directory
static std::string get_temp_directory(void)
std::string octave_getcwd(void)
static std::string get_host_name(void)
static std::string get_home_directory(void)
static octave_env * instance