From 74977f0459262c20df6bb4e1cdbe463876031fbe Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 8 May 2004 03:16:22 +0000 Subject: [PATCH] fix spurious "Couldn't create :" errors --- stepmania/src/RageFileDriverDirectHelpers.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/stepmania/src/RageFileDriverDirectHelpers.cpp b/stepmania/src/RageFileDriverDirectHelpers.cpp index 5df7320dae..ef183efed0 100644 --- a/stepmania/src/RageFileDriverDirectHelpers.cpp +++ b/stepmania/src/RageFileDriverDirectHelpers.cpp @@ -165,9 +165,16 @@ bool PathReady( CString path ) /* mkdir -p. Doesn't fail if Path already exists and is a directory. */ bool CreateDirectories( CString Path ) { + /* XXX: handle "//foo/bar" paths in Windows */ CStringArray parts; CString curpath; - split( Path, "/", parts, false ); + + /* If Path is absolute, add the initial slash ("ignore empty" will remove it). */ + if( Path.Left(1) == "/" ) + curpath = "/"; + + /* Ignore empty, so eg. "/foo/bar//baz" doesn't try to create "/foo/bar" twice. */ + split( Path, "/", parts, true ); for(unsigned i = 0; i < parts.size(); ++i) { @@ -176,10 +183,9 @@ bool CreateDirectories( CString Path ) curpath += parts[i]; #if defined(WIN32) - if( (curpath.size() == 2 && curpath[1] == ':') || /* C: */ - (curpath.size() == 3 && curpath[1] == ':' && curpath[2] == '/') ) /* C:/ */ + if( (curpath.size() == 2 && curpath[1] == ':') ) /* C: */ { - /* Don't try to create the drive letter alone, or the root directory. */ + /* Don't try to create the drive letter alone. */ continue; } #endif