[Box Backup-commit] COMMIT r1121 - box/trunk/lib/win32

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Fri Oct 27 20:15:49 BST 2006


Author: chris
Date: 2006-10-27 20:15:49 +0100 (Fri, 27 Oct 2006)
New Revision: 1121

Modified:
   box/trunk/lib/win32/emu.cpp
Log:
Convert UNIX to native paths automatically when opening files.


Modified: box/trunk/lib/win32/emu.cpp
===================================================================
--- box/trunk/lib/win32/emu.cpp	2006-10-27 19:14:52 UTC (rev 1120)
+++ box/trunk/lib/win32/emu.cpp	2006-10-27 19:15:49 UTC (rev 1121)
@@ -436,13 +436,26 @@
 // --------------------------------------------------------------------------
 std::string ConvertPathToAbsoluteUnicode(const char *pFileName)
 {
+	std::string filename;
+	for (int i = 0; pFileName[i] != 0; i++)
+	{
+		if (pFileName[i] == '/')
+		{
+			filename += '\\';
+		}
+		else
+		{
+			filename += pFileName[i];
+		}
+	}
+
 	std::string tmpStr("\\\\?\\");
 	
 	// Is the path relative or absolute?
 	// Absolute paths on Windows are always a drive letter
 	// followed by ':'
 	
-	if (pFileName[1] != ':')
+	if (filename.length() >= 2 && filename[1] != ':')
 	{
 		// Must be relative. We need to get the 
 		// current directory to make it absolute.
@@ -465,7 +478,7 @@
 		}
 	}
 	
-	tmpStr += pFileName;
+	tmpStr += filename;
 	return tmpStr;
 }
 




More information about the Boxbackup-commit mailing list