Mercurial > hg > xemacs-beta
diff lib-src/gnuclient.c @ 318:afd57c14dfc8 r21-0b57
Import from CVS: tag r21-0b57
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:45:36 +0200 |
parents | 4b85ae5eabfb |
children | 19dcec799385 |
line wrap: on
line diff
--- a/lib-src/gnuclient.c Mon Aug 13 10:44:47 2007 +0200 +++ b/lib-src/gnuclient.c Mon Aug 13 10:45:36 2007 +0200 @@ -179,8 +179,37 @@ fullpath[0] = '\0'; - if (filename[0] && filename[0] != '/') - { /* relative filename */ + if (filename[0] && filename[0] == '/') + { + /* Absolute (unix-style) pathname. Do nothing */ + strcat (fullpath, filename); + } +#ifdef __CYGWIN32__ + else if (filename[0] && filename[0] == '\\' && + filename[1] && filename[1] == '\\') + { + /* This path includes the server name (something like + "\\server\path"), so we assume it's absolute. Do nothing to + it. */ + strcat (fullpath, filename); + } + else if (filename[0] && + filename[1] && filename[1] == ':' && + filename[2] && filename[2] == '\\') + { + /* Absolute pathname with drive letter. Convert "<drive>:" + to "//<drive>/". */ + strcat (fullpath, "//"); + strncat (fullpath, filename, 1); + strcat (fullpath, &filename[2]); + } +#endif + else + { + /* Assume relative Unix style path. Get the current directory + and prepend it. FIXME: need to fix the case of DOS paths like + "\foo", where we need to get the current drive. */ + strcat (fullpath, get_current_working_directory ()); len = strlen (fullpath); @@ -188,10 +217,7 @@ ; /* yep */ else strcat (fullpath, "/"); /* nope, append trailing slash */ - } /* if */ - - strcat (fullpath,filename); - + } } /* filename_expand */ /* Encase the string in quotes, escape all the backslashes and quotes