# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1045982118 0 # Node ID e320dc29bfcd812956c4488458ee9893ef788450 # Parent 22a215209887c02bce3dbc5bd4a9ad21240b04d6 Rewrote abs_path() so the code will work on NT 4.0. diff -r 22a215209887 -r e320dc29bfcd win/dirent.c --- a/win/dirent.c Thu Feb 20 23:43:44 2003 +0000 +++ b/win/dirent.c Sun Feb 23 06:35:18 2003 +0000 @@ -56,24 +56,32 @@ return cache [unit] = r; } -char * -abs_path(const char *name, char *buffer, int len) +char *abs_path(const char *name, char *buffer, int len) { - char buf[4]; - if (isalpha(name[0]) && name[1] == ':' && name[2] == '\0') { - buf[0] = name[0]; - buf[1] = name[1]; - buf[2] = '.'; - buf[3] = '\0'; - name = buf; + char *buf; + LPTSTR file; + + if(isalpha(name[0]) && name[1] == ':' && name[2] == '\0') + { + int drive = _getdrive(); + char newdrive = toupper(name[0]); + + _chdrive((newdrive - 'A')+1); + + if(getcwd(buffer, len)) + { + _chdrive(drive); + return buffer; + } + _chdrive(drive); + return NULL; } - if (GetLongPathName(name, buffer, len)) - return NULL; - return buffer; + if(GetFullPathName(name, len, buffer, &file)) + return buffer; + return NULL; } -DIR * -openxdir(const char *path, unsigned att_mask) +DIR *openxdir(const char *path, unsigned att_mask) { DIR *dir; char name[MAXPATHLEN+3];