[Box Backup-commit] COMMIT r948 - box/chris/merge/lib/win32

subversion at fluffy.co.uk subversion at fluffy.co.uk
Sun Sep 3 23:54:58 BST 2006


Author: chris
Date: 2006-09-03 23:54:58 +0100 (Sun, 03 Sep 2006)
New Revision: 948

Modified:
   box/chris/merge/lib/win32/emu.cpp
Log:
(refs #3)

Convert UNIX to native paths 


Modified: box/chris/merge/lib/win32/emu.cpp
===================================================================
--- box/chris/merge/lib/win32/emu.cpp	2006-09-02 11:50:26 UTC (rev 947)
+++ box/chris/merge/lib/win32/emu.cpp	2006-09-03 22:54:58 UTC (rev 948)
@@ -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