Support paths w/ leading double slash (per an obscure corner of the POSIX spec) on platforms that implement it, currently just Cygwin. (Cygwin uses this for UNC paths.)

This commit is contained in:
Brian Cox 2016-08-07 23:24:15 -07:00
parent 3c08babd4f
commit aaa132d211
2 changed files with 13 additions and 1 deletions

View File

@ -307,9 +307,16 @@
#define ICONV_CONST_SOURCE (IS_MINIX)
#define SUPPORTS_DIRECT_IO (IS_LINUX)
// Linux is the only platform where direct i/o hashing has been tested & works properly so far.
#define SUPPORTS_TERMIOS (!IS_RTEMS)
// RTEMS errors are probably just a buildsys issue & this will change or go away.
#define SUPPORTS_DOUBLE_SLASH_PATH (IS_CYGWIN)
// POSIX standard says paths beginning with 2 slashes are "implementation defined"
// (see http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.html#tag_04_11 )
// The only platform OST works on (afaik) that actually defines a double-slash behavior is Cygwin
// which uses this syntax for UNC paths. So we'll allow leading double slashes there, but
// continue removing them on all other platforms
//=============================================================================
// Miscellaneous

View File

@ -234,7 +234,12 @@ void cFCOName::ParseString( const TCHAR* pszin )
TSTRING name(begin, at);
if (name.length() > 0 || components == 0)
//NOTE: To be truly standards compliant we ought to turn >2 slashes into 1, not 2.
#if SUPPORTS_DOUBLE_SLASH_PATH
if (name.length() > 0 || components < 2)
#else
if (name.length() > 0 || components == 0)
#endif
{
cFCONameTblNode* pNode =
cFCOName_i::msNameTbl.CreateNode(name);