]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
ixing a big problem on Windows platforms that has to do with copying over
authorrambetter <rambetter>
Mon, 13 Dec 2010 04:50:40 +0000 (04:50 +0000)
committerrambetter <rambetter>
Mon, 13 Dec 2010 04:50:40 +0000 (04:50 +0000)
game packs to the game install directory.  Before this patch, users of
Radiant weren't able to start Radiant without doing some manual copying of
game pack files over by hand (and I'm sure nobody figured that out).
The problem is in radiant/missing.cpp.  CopyTree() didn't correctly recursively
copy directories because of a problem in FindFiles::FindFiles() on Windows.

git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/trunk@346 8a3a26a2-13c4-0310-b231-cf6edde360e5

radiant/missing.cpp

index e610fbb02b4ec6a216edd18fde5d91f87a4ab5e4..246946830125efd01f88b14dc1ae80f9bda25f8e 100644 (file)
@@ -168,7 +168,17 @@ const char* FindFiles::NextFile() {
 #else
 
 FindFiles::FindFiles( const char *_directory ) {
+       char endChar;
        directory = _directory;
+       if (directory.GetLength() > 0) {
+               endChar = directory.GetAt(directory.GetLength() - 1);
+               if (!(endChar == '/' || endChar == '\\')) {
+                       // We're only using '/' as the path separator throughout this code, not '\'.
+                       // However, I'd hate to see the code silently fail due to a trailing '\', so
+                       // I added the check for it.
+                       directory += '/';
+               }
+       }
        directory += '*';
        findHandle = INVALID_HANDLE_VALUE;
 }