Ignore:
Timestamp:
Jul 28, 2011, 4:46:16 PM (14 years ago)
Author:
dmik
Message:

GetFileAttributesEx: Accept paths with trailing slashes.

The Win32 version of GetFileAttributesEx() treats paths like
'some\path\' as if they were 'some\path' -- hence Odin should
behave the same instead of always returning a failure on such
paths (PATH_NOT_FOUND) as DosQueryPathInfo does on OS/2.

This in particular fixes the Log command on repository roots
in SmartGit (OpenJDK).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/oslibdos.cpp

    r21638 r21674  
    807807  CharToOemA(ODINHelperStripUNC(pszName), pszOemName);
    808808
    809   // Treat 'x:' as 'x:\', this is what GetFileAttributesEx() does on Win32
    810   // instead of returning an error as DosQueryPathInfo() does
    811   if (pszOemName[1] == ':' && pszOemName[2] == '\0') {
    812     pszOemName[2] = '\\';
    813     pszOemName[3] = '\0';
     809  // Treat 'x:' as 'x:\' and 'some\path\' as 'some\path' -- this is what
     810  // GetFileAttributesEx() does on Win32 -- instead of returning an error as
     811  // DosQueryPathInfo() does
     812  if (pszOemName[1] == ':' && pszOemName[2] == '\0')
     813  {
     814      pszOemName[2] = '\\';
     815      pszOemName[3] = '\0';
     816  }
     817  else
     818  {
     819      int len = strlen(pszOemName);
     820      // note: the below leaves '\' (i.e. the root dir) as is
     821      while (len > 1 && (pszOemName[len-1] == '\\' || pszOemName[len-1] == '/'))
     822          pszOemName[--len] = '\0';
    814823  }
    815824
Note: See TracChangeset for help on using the changeset viewer.