42 #if defined (HAVE_CONFIG_H)
63 #if defined (OCTAVE_USE_WINDOWS_API)
75 : follow_symbolic_links (true), verbatim_pwd (true),
76 current_directory (), prog_name (), prog_invocation_name (),
77 user_name (), host_name ()
207 #if defined (__MINGW32__) || defined (_MSC_VER)
214 #if defined (P_tmpdir)
221 if (tempd.empty () || tempd == R
"(\)")
222 tempd = R"(c:\temp)";
228 #if defined (P_tmpdir)
246 #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && defined (OCTAVE_USE_WINDOWS_API)
247 wchar_t path[MAX_PATH+1];
248 if (SHGetFolderPathW (
nullptr, CSIDL_APPDATA | CSIDL_FLAG_DONT_VERIFY,
249 nullptr, SHGFP_TYPE_CURRENT,
path) == S_OK)
252 cfg_dir = local_app_data;
253 free (local_app_data);
258 if (cfg_dir.empty ())
286 std::string display =
getenv (
"DISPLAY");
288 return ! display.empty ();
301 static bool initialized =
false;
339 size_t len = home_dir.length ();
341 if (
len > 1 && home_dir ==
name.substr (0,
len)
356 size_t len = s.length ();
364 #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM)
365 if ((
len == 2 && isalpha (s[0]) && s[1] ==
':')
366 || (
len > 2 && isalpha (s[0]) && s[1] ==
':'
377 size_t len = s.length ();
382 if (
len == 1 && s[0] ==
'.')
388 if (
len == 2 && s[0] ==
'.' && s[1] ==
'.')
391 if (
len > 2 && s[0] ==
'.' && s[1] ==
'.'
410 if (pos == std::string::npos)
413 return s.substr (pos+1);
421 const std::string& dot_path)
const
431 std::string current_dir = dot_path;
437 size_t slen = s.length ();
469 if (sep_pos == std::string::npos)
471 current_dir.append (s, i, sep_pos-i);
474 else if (sep_pos == i)
481 current_dir.append (s, i, sep_pos-i+1);
488 current_dir.pop_back ();
515 #if defined (__MINGW32__) || defined (_MSC_VER)
519 std::string drv =
do_getenv (
"HOMEDRIVE");
559 host_name = (status < 0) ?
"unknown" : hostname;
615 size_t i =
path.length () - 1;
622 #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM)
624 if (i == 1 &&
path[i] ==
':')
644 (*current_liboctave_error_handler) (
"%s", std::strerror (err_num));
650 (*current_liboctave_error_handler) (
"%s", s.c_str ());
charNDArray min(char d, const charNDArray &m)
static std::string get_temp_directory(void)
std::string do_get_user_name(void) const
static std::string get_host_name(void)
static bool rooted_relative_pathname(const std::string &s)
std::string do_getcwd(void) const
std::string do_get_temp_directory(void) const
static bool have_x11_display(void)
static std::string base_pathname(const std::string &s)
bool do_rooted_relative_pathname(const std::string &s) const
std::string do_get_user_config_directory(void) const
std::string prog_invocation_name
bool follow_symbolic_links
std::string do_base_pathname(const std::string &s) const
static std::string get_program_invocation_name(void)
static void cleanup_instance(void)
static std::string getenv(const std::string &name)
static bool instance_ok(void)
static void set_program_name(const std::string &s)
static std::string get_home_directory(void)
std::string do_make_absolute(const std::string &s, const std::string &dot_path) const
std::string current_directory
static std::string polite_directory_format(const std::string &name)
static void putenv(const std::string &name, const std::string &value)
static bool absolute_pathname(const std::string &s)
std::string do_get_home_directory(void) const
static std::string get_user_config_directory(void)
bool do_chdir(const std::string &newdir)
static std::string make_absolute(const std::string &s, const std::string &dot_path=get_current_directory())
static std::string get_program_name(void)
std::string do_get_host_name(void) const
void do_set_program_name(const std::string &s) const
static std::string get_current_directory(void)
static bool chdir(const std::string &newdir)
std::string do_polite_directory_format(const std::string &name) const
bool do_absolute_pathname(const std::string &s) const
std::string do_getenv(const std::string &name) const
static std::string get_user_name(void)
void pathname_backup(std::string &path, int n) const
static password getpwuid(uid_t uid)
std::string dir(void) const
std::string name(void) const
static char * strsave(const char *s)
std::string dir_sep_str(void)
std::string dir_sep_chars(void)
int chdir(const std::string &path_arg)
void putenv_wrapper(const std::string &name, const std::string &value)
std::string getenv_wrapper(const std::string &name)
octave_value::octave_value(const Array< char > &chm, char type) return retval
const char * octave_set_program_name_wrapper(const char *pname)
char * u8_from_wchar(const wchar_t *wc)
int octave_gethostname_wrapper(char *nm, size_t len)