Mercurial > hg > octave-lyh
changeset 4088:933ac1113625
[project @ 2002-10-05 03:16:46 by jwe]
author | jwe |
---|---|
date | Sat, 05 Oct 2002 03:18:58 +0000 |
parents | a54f61b5d491 |
children | f70ce9baacd3 |
files | liboctave/ChangeLog liboctave/oct-env.cc |
diffstat | 2 files changed, 13 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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 <pkienzle@users.sf.net>
--- 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); }