30 #if ! defined (octave_shared_fcns_h)
31 #define octave_shared_fcns_h 1
35 #if defined (OCTAVE_USE_WINDOWS_API)
40 #if defined (_MSC_VER)
42 # define pclose _pclose
46 w32_get_octave_home (
void)
52 char namebuf[MAX_PATH+1];
53 if (GetModuleFileName (GetModuleHandle (
nullptr), namebuf, MAX_PATH))
55 namebuf[MAX_PATH] =
'\0';
57 std::string exe_name = namebuf;
58 size_t pos = exe_name.rfind (
'\\');
60 if (pos != std::string::npos)
61 bin_dir = exe_name.substr (0, pos + 1);
66 size_t pos =
bin_dir.rfind (R
"(\bin\)");
68 if (pos != std::string::npos)
80 #if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) \
81 && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM))
87 #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM)
96 char *value = ::getenv (
name.c_str ());
98 return value ? value :
"";
113 #if defined (OCTAVE_USE_WINDOWS_API)
115 oh = w32_get_octave_home ();
130 else if (op == oep && ! oh.empty ())
144 size_t len = s.length ();
152 #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM)
153 if ((
len == 2 && isalpha (s[0]) && s[1] ==
':')
154 || (
len > 2 && isalpha (s[0]) && s[1] ==
':'
#define OCTAVE_EXEC_PREFIX
std::string bin_dir(void)
octave_value::octave_value(const Array< char > &chm, char type) return retval
static std::string Voctave_home
static void set_octave_home(void)
static bool absolute_pathname(const std::string &s)
static std::string prepend_octave_exec_home(const std::string &s)
static const char dir_sep_char
static std::string Voctave_exec_home
static bool is_dir_sep(char c)
static std::string dir_sep_chars
static std::string prepend_home_dir(const std::string &hd, const std::string &s)
static std::string octave_getenv(const std::string &name)
static OCTAVE_UNUSED std::string prepend_octave_home(const std::string &s)