# HG changeset patch # User jwe # Date 1033787938 0 # Node ID 933ac11136251e96db035756abb29d364412d1ed # Parent a54f61b5d491e23dde653e2e4f66bb2617c4a321 [project @ 2002-10-05 03:16:46 by jwe] diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -4,6 +4,8 @@ filenames. (octave_env::do_make_absolute): Check for absolute name with do_absolute_path. + (octave_env::do_chdir): Likewise. + (is_dir_sep): New function. 2002-10-03 Paul Kienzle diff --git a/liboctave/oct-env.cc b/liboctave/oct-env.cc --- a/liboctave/oct-env.cc +++ b/liboctave/oct-env.cc @@ -228,11 +228,15 @@ return retval; } +static inline bool +is_dir_sep (char c) +{ #if defined (__CYGWIN__) -#define IS_DIR_SEP(c) (c == '/' || c == '\\') + return (c == '/' || c == '\\'); #else -#define IS_DIR_SEP(c) (c == '/') + return (c == '/'); #endif +} bool octave_env::do_absolute_pathname (const std::string& s) const @@ -246,16 +250,17 @@ return true; #if defined (__CYGWIN__) - if (len > 2 && isalpha (s[0]) && s[1] == ':' && IS_DIR_SEP (s[2])) + if ((len == 2 && isalpha (s[0]) && s[1] == ':') + || (len > 2 && isalpha (s[0]) && s[1] == ':' && is_dir_sep (s[2]))) return true; #endif if (s[0] == '.') { - if (len == 1 || IS_DIR_SEP (s[1])) + if (len == 1 || is_dir_sep (s[1])) return true; - if (s[1] == '.' && (len == 2 || IS_DIR_SEP (s[2]))) + if (s[1] == '.' && (len == 2 || is_dir_sep (s[2]))) return true; } @@ -450,7 +455,7 @@ if (len > 1) { - if (tmp[--len] == '/') + if (is_dir_sep (tmp[--len])) tmp.resize (len); }